SoX: How to Split Audio by Silence

Updated

Automatically split an audio file into separate clips whenever there is silence using SoX

SoX: How to Split Audio by Silence

Before we begin, make sure you have SoX installed and open your terminal inside the folder containing your audio file, which we'll call input.wav.

To split the recording into individual files, type or paste this command into your terminal and press enter:

sox input.wav output.wav silence 1 0.5 1% 1 0.5 1% : newfile : restart

Don't worry if the numbers look a little confusing; this simply tells SoX to look for half a second of audio below one percent volume, save a new clip, and repeat the process until the track ends.

Give your computer a moment to process the file; depending on how long your recording is, this usually takes just a few seconds.

Once your terminal prompt returns, run ls to confirm that your newly numbered output clips are sitting in the folder.

If the tool is missing pauses or cutting off words too soon, try adjusting the 0.5 second duration or the 1% volume threshold to better match the background noise in your recording.