How to remove silence at start and end of songs in your music collection

After failing to remove the songs’s silences only from the start or the end with FFmpeg, I ended up using an open-source tool (mp3splt-gtk) to achieve this. It did not have a particular good default settings for this purpose but it ended up doing a perfect job.

Ricardo Montero Rubert

Introduction: Why am I doing this?

In case you don’t know I have an ongoing project of restoring an old radio which has kept me busy (more or less) for the last 5 years. In fact, this is the second post related to this topic. The first post is about organising your music library. In that case the organising was required so that each song has the correct idiom, decade, and genre in order to create different radio stations (playlists).

The guilty one

Figure 1: The guilty one

The radio is fully functional now, and it does exactly what I wanted. Mimic a radio. I will try to be brief because this post is not about the radio. But basically, I have several playlists that are “radio stations”. That playlist should reproduce a song at a precise moment based on the system’s internal clock. That is at 12:00:00 you might be hearing Bon Jovi - Bed of Roses at time 45 seconds, and if you return to the station at 12:01:10 then you will be listening to the same song but this time in the 115-second position. When a song ends, it just skips to the next one.

You can probably see where this is going. If a song has an ending silence of up to 25 seconds, and the next song has a silence at the start of 5 seconds. This appears as 30 seconds of silence which is extremely awkward or you could tune in right in the silence and think it broke. The easiest solution is to trim these silences. If you are curious, herein-below there is a video of the radio working.

Software tried for this solution

Initially, this post was going to be about FFmpeg and how I used it for this purpose, but I couldn’t work out the specific command to remove a silence only if starts at time 0, and only if it finishes at time “song’s end”. So I had to keep investigating, I investigated Audacity, MPsplit and mp3splt-gtk before deciding to proceed with the latest one.



Figure 2: Audacity

FFmpeg is a great tool but you need to be an expert to control it properly, which I am not, for instance here is the page for the silence removal command. I tried to work out a command that would delete a silence if and only if the silence started at time 0 or the silence finished at time “song’s end”. But I failed, here is the Powershell + FFmpeg script that as it is, will delete any silence that encounters in a song regardless of its position.

The script is based on this FFmpeg command:

ffmpeg -i "input.mp3" -af "silenceremove=start_periods=1:start_duration=0.046:start_threshold=-50dB,silenceremove=stop_periods=-1:stop_duration=0.046:stop_threshold=-46dB" -b:a 320k -write_xing 0 -y "output_trimmed.mp3"



Figure 3: Audacity

I am surprised with the quality of Audacity has gotten in the latest versions. However, whilst doing a very good job at finding silences and trimming them. It has a few caveats:



Figure 4: MPtrim

MPtrim is a paid software that does an excellent job at trimming one and only one song, with plenty of options and free to use.

Mp3splt (and Mp3splt-gtk)


Figure 5: Mp3splt-gtk

Mp3splt is a great tool to deal with silences. It has not been updated since 2014, so do not expect any new features. The software is focused on splitting recordings of a whole CD/Vinyl/Cassette, into different files. However, also is able to deal with silences only at the start and end of a song.

How to use the software

Go to the Mp3splt website and make sure you donwload the mp3splt-gtk 0.9.2 version. Uncompress the zip and then locate the mp3splt-gtk.exe and run it. You need to use the second tab, the one called “Batch & Automatic split”, the first one is kind of useless for our purpose as it is to remove silence manually one by one.

From the options below, make sure to select the one that says Trim using silence detection, and set up the threshold level you want (Anything between -50dB and -42dB is fine). The program has some questionable default values, but if you click on the Batch split button on the top right corner it should kind of work.

Lets gonna configure the application to keep the original ID tags and replicate the folder structure. Go to Application > Preferences.

Now you can close the preferences, press the Batch split button, go for a coffee and let the software do its job.

  1. This took me a lot of searching and trial and error and it seems that the flag -write_xing 0 must be added right before the output filename to solve it.↩︎

  2. I could have dealt with the other problems, but this one was the real deal-breaker.↩︎

  3. I do not support any subscription business. So game over.↩︎

  4. I tried to test this by inverting one of the trimmed songs, aligning it, and then combining the tracks. If they carbon-copies the results should be silent, but it wasn’t. However, I did not spend much time aligning as it is a tedious task.↩︎