Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Audacity to process some short audio clips - about 300 of them (!!!), so I'd really rather not repeat my steps manually for each one.

However, I can't seem to find a way to create a chain which includes the "split stereo track & discard right channel" step. I'm at my wits' end; is there any way to do this? If not, is there another program that would let me do this in an automated fashion?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

I would suggest using sox for this kind of thing. Drop right channel with:

sox in.wav out.wav remix 1

To reduce noise, you need to get a noise profile from a silent part of the file, i.e. something like this:

sox noisy.wav -n trim 0 1 noiseprof | play noisy.wav noisered

See the below for details on noiseprof and noisered.

So the sequence for each file would look something like this, assuming that the first second of the recording only contains background noise:

sox in.wav -n remix 1 trim 0 1 noiseprof NOISE_PROFILE
sox in.wav out.wav remix 1 noisered NOISE_PROFILE

From the sox man:

   noiseprof [profile-file]
          Calculate  a  profile of the audio for use in noise reduction.  See
          the description of the noisered effect for details.

   noisered [profile-file [amount]]
          Reduce noise in the audio signal by profiling and filtering.   This
          effect  is  moderately  effective at removing consistent background
          noise such as hiss or hum.  To use  it,  first  run  SoX  with  the
          noiseprof  effect  on a section of audio that ideally would contain
          silence but in fact contains noise - such  sections  are  typically
          found  at  the beginning or the end of a recording.  noiseprof will
          write out a noise profile to profile-file, or to stdout if no  pro-
          file-file or if `-' is given.  E.g.
             sox speech.wav -n trim 0 1.5 noiseprof speech.noise-profile
          To  actually  remove  the  noise, run SoX again, this time with the
          noisered effect; noisered will reduce noise according  to  a  noise
          profile  (which  was generated by noiseprof), from profile-file, or
          from stdin if no profile-file or if `-' is given.  E.g.
             sox speech.wav cleaned.wav noisered speech.noise-profile 0.3
          How much noise should be removed is specified  by  amount-a  number
          between  0 and 1 with a default of 0.5.  Higher numbers will remove
          more noise but present a greater likelihood of removing wanted com-
          ponents  of the audio signal.  Before replacing an original record-
          ing with a noise-reduced version, experiment with different  amount
          values  to  find  the optimal one for your audio; use headphones to
          check that you are happy with the results, paying particular atten-
          tion to quieter sections of the audio.

          On  most systems, the two stages - profiling and reduction - can be
          combined using a pipe, e.g.
             sox noisy.wav -n trim 0 1 noiseprof | play noisy.wav noisered
share|improve this answer
    
This looks promising - but it still seems as though I would have to manually inspect each track to determine where to take a noise profile from. Do you know of any way I can get sox to do that automatically, or is it simpler to use sox batch-processing for dropping the channel and then Audacity chaining for the noise reduction? –  Arkaaito Jun 28 '12 at 12:05
    
A couple of things: 1) If the noise profile is similar for all files, you only need to do it once. 2) sox trim and stats effects might be enough to assess if a certain part contains only background noise. vad and silence effects might also work, but I have no experience with them. (see soxeffect(1) for more). 3) I'm new to Audacity chaining, so I am unable to compare workloads. –  Thor Jun 28 '12 at 12:39
    
Ah, I had misunderstood how the noise profile worked. Your comment helped clear up my confusion, as did running my workflow a few times. Reusing the noise profile was indeed perfectly sufficient for all the files (since they were originally recorded at the same time, on the same equipment). After exploring sox for a few days (not continuously!), I can say: wow! Thank you for introducing me to this amazing toolkit! (And, uh, sorry for this rather delayed final reply.) –  Arkaaito Jun 30 '12 at 21:20

I have an idea which could work, but before I write out the whole thing, have a try:

  1. Get yourself an FFMPEG build: http://ffmpeg.zeranoe.com/builds/
  2. Extract
  3. Run FFMPEG with the following parameters: ffmpeg -i somefile.mp3 -ac 1 somefile.wav

This will load somefile.mp3, limit the audio channels to one, hopefully removing the correct audio channel (the right one), then spitting it back out as a WAV file.

If this doesn't work, we have to figure out how to make ffmpeg remove the other channel.

share|improve this answer
    
if the above thing works out, then you can just write a batch file to loop over those 300 files... –  tumchaaditya Jun 28 '12 at 11:17
1  
I wouldn't recommend extracting the MP3 to yet another MP3, which would really degrade the quality. Rather do it as WAV. See my edit. –  slhck Jun 28 '12 at 11:24
    
@slhck It was just an example, anyway. FFMPEG is pretty intelligent. It (most of the time!) doesn't do conversions when no conversions are needed. It might just cut off the second channel and not re-encode stuff... –  sinni800 Jun 28 '12 at 11:40
    
No, it won't do that. That's where actually trying solutions yourself before posting them comes into play ;) You'd have to specify -c:a copy after the -i option to tell it to copy the bitstream. Per default, FFmpeg will always do conversions except when you explicitly specify the copy encoder. –  slhck Jun 28 '12 at 11:49
    
@slhck I DID try this before. I converted AVI videos with an MP3 stream to MP4 without any other parameters... It automatically determined that the MP3 stream should be stream-copied –  sinni800 Jun 28 '12 at 11:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.