sox – Remove Beginning & End Silence

By | Command Line, Linux

SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.

In this tutorial I will show you how to to get rid of silence on both ends of audio with:

sox in.wav out.wav silence 1 0.1 1% reverse silence 1 0.1 1% reverse

This command is equivalent to:

sox in.wav temp.wav silence 1 0.1 1% reverse
sox temp.wav out.wav silence 1 0.1 1% reverse

It’s trimming only the beginning of the file. For it to get both sides it’s using the reverse directive then reversing it back to normal.

This website does a great job explaining what is going on with the silence option.

Leave a Reply

Your email address will not be published. Required fields are marked *