Auto Tag Your MP3 Collection

I have a bunch of mp3's that I created with cd-xtractor. Unfortunately, though this program did a fine job at ripping my CDs, it didn't (as I'd expected) set the proper ID3 tags, though the file names themselves contain the artist and the track.

This lack of identification has been a low-level source of irration to me. I know what the files are, but my mp3 playlist would be so much nicer if it had proper ID3 tags.

Fortunately, I discovered a new webservice this evening called MusicDNS. It's very cool: it converts your mp3 to wav, fingerprints it via Fast Fourier Transform, and invokes a webservice at musicbrainz.org to get back the track and artist names.

Getting started was easy. The library and examples compiled almost out of the box with Visual Studio 2005. The program named "example" is the one to start with. Feed it a filename and it spits out the info: example.exe "e:\music\Jimmy Page & Robert Plant - Nobody's Fault But Mine.mp3" Decoding file e:\music\Jimmy Page & Robert Plant - Nobody's Fault But Mine.mp3 Title: Nobody's Fault But Mine Artist: Page & Plant PUID: a15a9cb2-d016-0eea-083b-a495f70b08c8

A few caveats to be aware of:

  • You need at least 135 seconds of audio for fingerprinting. This is cutting it close for older files. For example, Bill Haley's 1950's classic "See You Later Alligator" is 146 seconds long. Unfortunately, MusicDNS doesn't recognize it.
  • I extended the example program to display the Album, Genre, and Year of each track, but unfortunately the service itself doesn't return this info (or does so very rarely). Too bad.

Here's the program I wrote to classify my MP3s, in ruby of course! FYI, you'll need the excellent ruby-mp3info library (just "gem install ruby-mp3info" and you'll be fine!)