Subscribe to Make Magazine Today!


It’s funny how you can use a technology countless times and the knowledge of how it works can still rank somewhere between very little and zero. In the spirit of taking things apart and in the interest of getting to know everybody’s favorite media format in more intimate detail, Björn Edström dissected the MP3 format and created this most excellent manual for making your own MP3 decoder from the ground up.

Even though MP3 is probably the single most well known file format and codec on Earth, it’s not very well understood by most programmers – for many encoders/decoders is in the class of software “other people” write, like standard libraries or operating system kernels. This article will attempt to demystify the decoder, with short top-down primers on signal processing and information theory when necessary. Additionally, a small but not full-featured decoder will be written (in Haskell), suited to play around with.

This article reminded me of a bunch of Commodore 64 manuals I’ve been hanging on to. These are the 6 page user guides that came inside the box when you purchased something like a printer or a modem. Most of them, right on the back page, have a printout of driver code for the device. You would literally type in the source code off this single page, toss it in your own programs, and you’d understand exactly how the device worked from the moment you started using it.

I’ve got way cooler things than a 300 baud modem on my desk these days, and I can appreciate that I likely won’t ever have the same level of deep knowledge with these devices, not like I did with the stuff I played with in the 80’s. That said, it’s awfully illuminating to dig all the way down from time to time, to get familiar with the inner details of the technology you use every day.

Let’s build an MP3-decoder!

  • RapidEye

    The generation that follows us will undoubtedly be much more computer savvy than we are (I’m the same age as the writer) and won’t even see them as a tool, but rather a ubiquitous piece of hardware. But only because they stand on the shoulders of giants, most notably, their parents, older uncles/aunts, etc.

    They’ll never know the joys of successfully getting a coax tokenring network to actually push data around successfully for a whole work week without crashing.

    They’ll never know the joys of successfully hacking a 1Mb IPX/SPX game to play over the ineterwebz on a 9.6 kBaud modem, and then later successfully figuring out how to lead targets to adjust for ever changing lag. Or later figuring out how to “adjust” your lag to help you beat some other guy who always kicked your ass. =-)

    Technology is pretty amazing, but how many DVD watchers actually can name the codec that actually decrypts the DVD they are watching and converts it to a format that can be pushed down a single piece of copper wire to the back of their CRT TV???? Let alone tweak that codec so that it works on their GE TV in the bedroom instead of the JVC in the living room or the Sony in the family room………

  • Bob Smith

    It should be noted that (at least in the US) doing this can be considered illegal due to patent law. For more info see this: