Normalizing mp3s with mp3gain and Amarok

I’ve mentioned here before that my digital music collection is massive. We’re at 15,000 songs with more being added every month. I’ve built this collection from a number of sources, including ripping from CDs, purchasing from iTunes, and downloading from eMusic. This has left me with a gigantic music library, and a music library that has some drastic volume variation!

While I will often listen to whole albums, I am much more likely to have Amarok throw up a random playlist. But that can be a sometimes-painful experience, as one song plays at such a low volume that I have to crank up the speakers, but then the next song plays so loud that it rattles my monitor.

I’ve known that I needed to normalize the volume on my collection for quite a while. But that’s a daunting task when faced with 15,000 songs. Fortunately, I stumbled across a few articles about replaygain, and found a link to mp3gain. Once that was installed, I then modified instructions from porg.es as follows:

     find . -iname '*.mp3' -execdir mp3gain -a -k "{}" + &

Run this in the root of your music directory (for me, that is /music), wait a few hours (overnight). And then, voila!

Oh, just to explain the command above: “find . -iname ‘*.mp3′” searches for all mp3 files. -execdir executes the command on a directory basis. The -a switch to mp3gain tells mp3gain to use Album gain instead of Track gain (very important!), and the -k tells mp3gain not to increase the volume so much that there’s distortion in playback.

It is also important to point out that mp3gain doesn’t make any changes to the actual music data in the MP3 file. It simply adds a tag with the replay gain adjustment value. For example, a very quiet song might get a replay gain value of +4. That means that the player needs to crank the volume up when it plays the song to keep things at a fairly-normalized volume. Which directly implies that you need to use a music player which can read and use the replay gain tags.

Amarok doesn’t seem to do this out of the box. But fortunately there’s a ReplayGain Amarok script which does. Download and install the ReplayGain script, and then launch it from Amarok’s Script Manager. As Amarok plays a track, the script checks for a replaygain tag. If there’s one, then ReplayGain adjusts the volume accordingly. If there isn’t a tag, ReplayGain politely informs you that there’s no replaygain info in the track. This is actually amazingly useful, because it reminds one to run mp3gain on that track.

I know I am rambling: blogging while stoned on cold medicine is always risky. But trust me, mp3gain + Amarok + ReplayGain = sonic nirvana.

Related posts:

  1. apt-get install amarok (1.4 for Ubuntu Breezy)
  2. links for 2007-02-28
  3. Tagging music via Wired

3 Responses to “Normalizing mp3s with mp3gain and Amarok”

  • Porges says:

    Actually, mp3gain does change the actual music data in the MP3 file, it doesn’t actually write a true “ReplayGain tag”. However, it also writes a tag explaining exactly what it did so that it can be reverted later; the actual modification is lossless because it only edits the volume of each frame and not the audio data itself.

    I count this as a good feature because you can then use the same MP3 file in all your audio software/equipment without having to worry about whether it supports ReplayGain or not :)

  • Miguel Angel says:

    Your article is quite a bit outdated. Since long the replaygain script tags the files for you. Just use the context menu in the playlist.

  • Biffster says:

    That’s awesome info, Miguel. Thanks for the pointer! I tend to use mp3gain very frequently, so it’s never a problem to re-run it against a track. But it is nice to know that I can do this with just a mouse click.

    ‘course, Amarok is usually minimized in the system tray on my Ubuntu desktop, and I’ve learned to ignore the pop-up saying that the track doesn’t have any replaygain info (mostly from podcasts).

Profile picI am a 40-ish uber-geek, Daoist and family man. Blessed to have one incredible wife and three wonderful kiddos. Dao has been kind to me.

Archives
March 2007
S M T W T F S
« Feb   Apr »
 123
45678910
11121314151617
18192021222324
25262728293031
QR Code
Top categories