Music has been on my mind a lot lately. I thought I was done writing about (streaming) music, but I was wrong. A few things were still missing in my how to stream your own music (reprise) post. I wrote:
The jump in quality from
128 kbps[mp3 files] to 192 (and especially higher) is huge. It’s up to you whether or not to exaggerate: if you have the space, why not. The Bandcamp albums are still downloaded as
190 kbps), but the option to download larger files is there.
I didn’t really think about the file format or audio codec: MP3 has been the standard for so long—it’s been developed in the eighties and released in 1991, the same year as the release of Duke Nukum I for DOS. Every single (retro) portable music player is capable of playing
.mp3 files. So naturally when thinking about ripping CDs, MP3 comes to mind.
But a lot has changed since the early nineties when it comes to computing power, algorithm effectiveness, and even licenses. Two main contestants consistently beat MP3 when it comes to quality, according to numerous conducted listening tests:
Before we dig deeper, though…
Why still use (lossy) coding?
The sole reason to encode audio is an economic one. The average file size for a 4 minute long
.wav file—according to this calculator—is
42.3 MB with a sample rate of
44.1 kHz and 16-bit depth. That’s
546 MB for 13 songs. Half a gig for only one album! In the nineties, when the first generation iPods were released, a handful of gigabytes was considered large, but instead of carrying two or three albums, when compressing, you can fit tens—or even hundreds—of albums.
A few simple formulas help in calculating the file size of a compressed file:
- The bit rate of audio files: sample rate * bit depth * channels (2 for stereo) =
1441.2 kbpsfor CDs.
- The file size: ((bit rate / 8) * track length in minutes * 60) / 1000.
A (CBR or constant) bit rate of
192 kbps would result in
5.76 MB. That’s about
13% of the original size! Amazing what technology can do. The problem with codecs is that in order to get rid of
86% of the file size, the analog sine wave that is the sound of the track will get distorted. Clever engineers limited this to removing the parts (most) humans can’t hear anyway. The article what data compression does to your music explains this much better than I can.
A common misconception is that newer algorithms further reduce the file size. That is incorrect. The bit rate is the bit rate. However, with Vorbis or AAC, the quality at lower bit rates is much better. Thus, with MP3s, where you’d need 320 for an “excellent” quality, Vorbis files encoded at 200 require less bits (size) for a comparable quality.
But indeed, why would you still settle with ultimately still sub-par quality compared to CDs? Storage space has become very cheap lately, and the Free Lossless Audio (FLAC) codec still manages to halve the WAV space without losing a single bit of quality. “True” music fanatics don’t compensate, they proudly store gigabytes (or teras?) of
.flac files—even when locally streaming.
My reason for still using lossy coding is threefold:
- My NAS storage space is still limited, and I don’t like wasting space;
- My own ABX high fidelity audio hearing test results were quite sobering: with my current lousy equipment, I can’t even discern the difference between a 192-encoded MP3 and a FLAC file.
- I still like fiddling with retro (music) hardware from time to time that doesn’t work well with newer codecs1.
See—or hear—for yourself if you have more sensitive ears than I do. This is a highly subjective matter. Rip a few tracks and encode them using different bit rates and different codecs. Try listening to those with the best equipment you have and turn the volume up. For the lazy, here’s another online test. Good luck, the result may surprise you.
Which post-MP3 codec to choose?
Wait a minute. Why would we not choose MP3? “Because it’s licensed, that stinks!” isn’t true anymore—it’s been free for quite a while now, both in the European Union and outside. It is true that a decade ago, large sums were involved in law suits concerning copyright infringement just because of an algorithm license, so I understand why many view the MP3 codec as unethical.
Again, if compatibility is your concern, then I don’t see why you shouldn’t. I’ve had great success with LAME’s
--preset extreme (A Variable Bit Rate (VBR) of about 210-250 kbps). To me, a CBR of 320—the “best” MP3 has to offer—is overkill.
Vorbis was conceived as open source software. AAC—the “official” successor to MP3, by the way—does not require a license to stream or distribute in the format, but it does for manufacturers or developers of codecs. Apple’s involvement and DRM issues made AAC both popular and shaky in the early noughties, but in listening tests on lower bit rates, it’s been known to consistently beat both MP3 and Vorbis. But then again, those tests are meaningless and highly subjective.
Modern codecs usually support more channels and more flexible sample rates: from really low (8 kHz) to really high (96 kHz), but this is useless when ripping CDs that come at 44 anyway. Besides their efficiency, they also handle higher audio frequencies better, resulting in less harsh sounding artifacts at low bit rates.
I’m all but an expert when it comes to the internals of these codecs, but you don’t need to be to hear a difference in quality. Again: experiment with this yourself!
In 2013, Vorbis itself is actually being deprecated in favor of the Opus format, which has an even higher compression efficiency and a low encode/decode latency. This makes it ideal for VoIP: it’s currently being used by WhatsApp, Discord, PS4, and the like. Yet, for high quality music at high bit rates, it’s still not that well-supported.
Which codes are currently being used by popular streaming services? Spotify uses AAC for their web player (128 kbps free, 256 kbps premium) and OGG/Vorbis for their desktop app (up to 320 kbps as “very high” dependent on your bandwidth). Tidal was conceived to offer the “real” experience with FLAC, but even if you’re an audiophile, you won’t notice the difference unless you’ve invested thousands of dollars into high-end equipment… Deezer’s High Fidelity stream also uses FLAC, but you’ll have to get the Premium subscription for that.
In the end, it boils down to personal preference, although it is striking that none of the streaming services still rely on MP3. To my ears, and probably many others as well, there is no difference between MP3 320, Ogg/Vorbis or AAC 190+, and FLAC. Why would you waste space then? Scratch FLAC. Why would you still use an outdated compression technique from the early nineties with initially unethical licensing options? Scratch MP3. Of the two that remain, only Vorbis is truly open source—albeit less well-supported. I’m going to roll with
oggenc -q 7 for a while (VBR of +/- 190 kbps) and see what it does.