I know that this is random, but I came upon this problem for a project at work. Googling it led me to a bunch of commercial solutions and non-useful resources. I wanted at least one useful article to have a chance in the search engines.
Here was my Problem
I have many directories of wav files that in the old days were used to create a CD set which we sold. We haven’t sold the CD course for several years now, and the boss recently said “Let’s release the whole shebang for free as a podcast or something.” I could go through and convert and tag all the wav files to mp3s and then post them separately. But I’m lazy and some of the 18 or so CDs have over 20 tracks. How much easier would it be if I could just combine one CD’s worth of material into a single track?
This is pretty straightforward to do in Audacity, but I would still have to import all those tracks and line them up end to end. I wanted something a little more automated. What I found was a command line tool called sox. Sox is cross platform, so you can do this on Win/Mac/Linux, although my comments will be directed specifically for the windows crowd.
Now to The Useful Part
- Download & install sox (Sound Exchange) Make sure you put sox on your “path.” If you don’t know how to do that, here’s one walkthrough.
- Download & unzip the LAME mp3 Encoder into the sox directory. On that download page, I used the x86-Win32 version. You’ll need this if you are working with mp3 files.
- Put a bunch of audio files that you want to merge into a directory.
- Open a command window in that directory. If you are in the windows file explorer, you go can hold down shift while right clicking on a folder. “Open command window here” will appear on the pop up menu.
- Type the sox command.
sox input_file_name_1.wav input_file_name_2.wav [... more input file names] output_file_name.mp3
Now let sox do it’s magic. My files were already conveniently named in the order I wanted them in the merged file, so I could use
sox *.wav output.mp3
Note: if you have a lot of files, this will take a while. Just have faith that your prompt will eventually come back.
You can do a lot more with sox if you want the output mp3 to have different-than-the-default quality and bit rate. You can also boost volume and do all sorts of other processing. All of that, however is beyond the scope of this post.
There, now I only have to tag 18 files rather than spend a whole day doing it.
Oh, and if you’re at all curious as to the project I’m doing, it’s a real estate investment training course. I’ll start posting the audio files within a day or two.