A few years ago I attempted to write an ID3 tag parser for MP3 files. The ID3v1 specification was easy to understand and implement, but the complex ID3v2 specification threw up some hurdles with SyncSafe integers, encoded bits, multiple sub-versions (ID3v2.2.0, ID3v2.3.0, ID3v2.4.0), and custom frame data. Needless to say, I couldn’t implement the specification properly and my parser would trip up on certain MP3 files, but I’ve recently revisited this project and fixed the showstopping bugs.
Other than the ID3v2 specification, there’s rather sparse information about programming ID3v2 tags on the web. What would have made this process so much easier is a utility that could list all of the ID3 tag info, such as ID3v2 frames and their sizes. With this info, I could have cross referenced with my own parser to see where things were going wrong. Unfortunately, a utility like this doesn’t seem to exist and the best thing I could come by was using Winamp or a similar app to read a limited amount of ID3v2 tag info.
More recently, I was developing a web-based MP3 player for personal use and I decided it would be imperative to include Last.fm song scrobbling. This would require parsing the song information from the ID3 tag and submitting it to Last.fm, so I had to fix my ID3 tag parser. In the process, I developed that utility I mentioned earlier which would have made programming this parser so much easier. Head on over to the Software Development section and check out Perry’s ID3 Tag Viewer.
Looking back at the ID3v2 specification, it isn’t a bad one. There are some “gotcha” and “ahah” moments that will surely set your head for a spin at first, especially since I tackled this monstrosity without prior knowledge of bits and binary numbers. But that’s just how I function and how I learn best.
I finally have an ID3 parser for Last.fm scrobbling support in my future applications!