Other things on this site...

MCLD
music
Evolutionary sound
Listen to Flat Four Internet Radio
Learn about
The Molecules of HIV
MCLD
software
Make Oddmusic!
Make oddmusic!

Applying ReplayGain to all yr MP3s

I've just discovered the really handy mpd (music player daemon) which is pretty much the perfect command-line geek's music player service. No graphical interface, no nothing.

Anyway

It's currently playing my MP3s on shuffle and it's great, but the MP3s are a bit too varied in their volume: some are too loud, some are too quiet. And this is where the magic of ReplayGain comes in. ReplayGain is a hint that can get embedded in an MP3 about how loud it should be, and there's a linux command called "mp3gain" that can analyse your files for you and make sure they're all equalised volumewise. If you have a folder containing ten MP3s from an album, you can run a command like

   mp3gain ~/Music/theAforementionedAlbum/*.mp3

and it'll do the business. The extra-clever bit is that it also applies album-wise ReplayGain - assuming that all the files you've given it are off the same album, which has been carefully mixed to have loud bits and quiet bits, it'll specify an albumwise level as well as an individual trackwise level.

So far so good, but what if you have a million albums of a billion MP3s? You'd need to run that command once for each album.

Or you could do some command-line kung-fu. This command is what's running on my linux box right now (should work on mac too):

   find -L ~/Music/ -name "*.mp3" -exec dirname "{}" \; | uniq | while read line; do mp3gain -k -o -r "$line"/*.mp3; done

It uses find to find all my MP3s, dirname to find which folder they're in, uniq to make that a unique list of folders, then while read line to feed that info one line at a time to the mp3gain command. Therefore it's feeding it with one folderfull at a time, rather than just one MP3-file at a time, which should allow it to do the ReplayGain thing best.

| linux | Permalink

social