What, exactly, does MP3 compression do to music?
I’m not asking how MP3 works, as there are volumes of mostly incomprehensible texts written on that subject. And I’m not asking whether MP3 sounds great, or is the purest form of evil ever foisted on mankind. The flames of those wars are still burning bright. I’m just innocently asking a question: What does it do to music?
The quickest answer might come from listening to the same music both uncompressed and then as MP3. I’m guessing everyone reading this blog has long-ago been through that exercise and has arrived at what they hear as the difference(s). So that begs the question, what are the differences? Before I address that question, let me digress briefly…
One of the things I remember hearing often in the early days of MP3 (Napster, anyone?) was that of course it sounded terrible because it threw away 90% of the musical information! While my ears told me that things were missing and/or different from the original, they did not tell me that 90% was missing. But the math was pretty simple and seemed convincing, so let’s do it:
CD Date Rate = 44,100 [samples/channels*sec] * 2 [channels] * 16 [bits/sample] = 1,411,200 [bits/sec]
The most common MP3 data rate in the days of file sharing was 128,000 [bits/sec] (ie: 128 MP3)
(128,000 / 1,411,200) * 100 = 9.1 % (So the 128 MP3 has 9.1% of the data rate of CD.)
Similar calculations will show that a 64 MP3 comes out at 4.6% and a 320 MP3 comes out at 22.7%. So yeah, it sure looks like a whole lot of information must be missing, right? Thanks to a lot of smart people and the miracle of psychoacoustics, it doesn’t come out quite as bad as those numbers would suggest. After all, “lossless compression” drops the data rate to about 55%, and doesn’t lose anything…
So how does MP3 encoding change your music? The technique I employed to find out was to rip music from a CD and save it as a lossless wave file. I encoded the wave as an MP3, and then converted the MP3 back into a wave. The idea here is that the encoding from wave to MP3 loses something, but converting the MP3 back to a wave should not lose anything. I then determined the difference between these two waves by subtracting the MP3 based wave from the original lossless CD wave. The difference between the two should represent what has changed, or what the MP3 encoding did to the music. If there was no change, the difference would be silence.
I originally tried doing the subtraction in an audio editor, but was not happy with the results. It turns out that MP3 encoding not only throws some things out, which subtraction should identify, but it subtly changes the timing as well. I found it impossible to properly align the two waves in time to give the best estimation of what had changed. But thanks to a piece of freeware from Bill Waslo of Liberty Instruments (www.libinst.com), the task became manageable. Liberty Instruments came up with “Audio DiffMaker” specifically for the purpose of comparing two audio recordings to see how they are different. I think the original idea behind Audio DiffMaker was to see how amplifiers, cables, etc. changed an audio signal, but it was a perfect fit for my needs.
There may be more sophisticated methods of knowing exactly how encoding changes music, but if there are, I don’t have access to them. This technique should work with any encode/decode cycle (ie: not MP3 specific), and is free and easy for you to try yourself. My guess is that the difference files I generated are “worst case” and that a perfect difference that somehow exactly matched things would show even less difference than my technique. But it is nonetheless kind of interesting!
I’ve posted a zip file that contains seven audio files. One is the original lossless music saved as a wave file, three are MP3 versions of the same music sample, and three are the difference files between the original wave and the MP3 equivalent. The sample is a ten second excerpt from Dave Matthews which most of you will recognize. You can download the zip file here.
Leave a comment and let me know what you think. Do the difference files sound like you would have expected? Do they contain more or less information than you would have thought? What a fun hobby we share!