Archive for March 8th, 2007

links for 2007-03-09

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 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.

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.

March 2007
« Feb   Apr »
QR Code
Top categories