SoX: How to Concatenate Audio Files

Updated

Learn how to join multiple audio files into one using SoX

SoX: How to Concatenate Audio Files

Install SoX

Before we start, make sure you have SoX installed on your computer and the audio files you want to join ready in a folder. If you don't have SoX yet, you can install it with Homebrew:

brew install sox

Join the Files

First, open your terminal and navigate to the folder containing your audio files. To join them end to end, just list them in the order you want them, with the name of the new file, like output.wav, at the very end:

sox file1.wav file2.wav output.wav

Just swap file1.wav and file2.wav with your actual file names. You can list as many files as you like, and SoX works with .mp3 files too. To join every matching file in a folder, use the * wildcard, like sox part*.wav combined.wav.

For short clips, this finishes almost instantly, and don't worry if you don't see a success message. To make sure everything worked, run soxi -d output.wav. The -d flag prints just the duration, and it should match the length of all your clips added together. You can also run play output.wav to have a listen.

undefined

All your files need the same sample rate and number of channels. If you get an error like Input files must have the same sample-rate, convert the odd one out first with sox input.wav -r 44100 output.wav, then join them again.

The -r flag sets the sample rate, so just change 44100 to match your other files.