Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to familiarize myself with sox to do some audio processing tasks. Ultimately, I want to take all my WAV files and extract just one channel, and save them, ideally with a modified name (e.g. input 55_55.wav would become left_55_55.wav). Right, now, though I'm just trying some basic stuff and encountering problems.

For example, looking at the duration of just one file works fine:

sox --i -D 55_55.wav

But trying to run the command on all the .wav files in the directory doesn't work out:

sox --i -D *.wav
sox FAIL formats: can't open input file '*.wav': Invalid argument

What's going wrong here?

I tried several variations (e.g. ./*.wav and changing the relative location of *.wav) but haven't been able to solve it. I'm hoping to figure out how to do something to every .wav file in order to accomplish my goal, and it seems like using *.wav for the input could be the right approach, but it's not working out so well. Any thoughts?

I thought something like the following lie would work out to extract one channel from every file and save that one channel with a modified name, but it seems I was a little too hopeful:

sox *.wav -c 1 left*.wav remix 1 0
sox FAIL formats: can't open output file `left*.wav`: Invalid argument
share|improve this question
sox --i -D *.wav works here, are you in the correct directory? What does echo *.wav say? – Thor Mar 31 '14 at 9:00
To extract the left channel from multiple files and save it separately you need to use a loop, e.g. for wavfile in *.wav; do sox "$wavfile" "left_$wavfile" remix 1; done. – Thor Mar 31 '14 at 9:11
I'm pretty sure I'm in the right directory. ls returns all the files I expect, I can use the command on individual files, and the text before > is the right directory. – Jota Mar 31 '14 at 21:54
So your problem is that *.wav is not getting expanded, what shell are you running this in? Try running the loop in a bash shell. – Thor Apr 1 '14 at 7:42
Sorry I was under the misapprehension that you were running this in a different shell. cmd.exe also supports for-loops, see for example this website. Something like this should work: for %wavfile in (*.wav) do sox %wavfile left_%wavfile remix 1. – Thor Apr 1 '14 at 21:40

Your Answer


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

Browse other questions tagged or ask your own question.