The question of audio in any computing environment is one that is going to be rife with complexity, license concerns, and a religious sense of maintaining the status quo of various older formats. Storing audio for mobile usually means two things. Firstly, you are likely going to want smaller files in order to pack more runtime into a device with a limited storage capacity. The second thing to consider is what formats the device you plan on using is capable of playing. For most mobile applications, the use of the old standby Mp3 is probably going to be seen as it has great inertia and subsequently is supported everywhere. When one isn’t constrained by mobile device requirements things can get much more interesting. Without storage requirements, a regular computer user is free to use a lossless codec. With 3TB hard disks in the $100 range, there is little reason to archive music in a lossy format. This leaves us with three general options that work for different use cases.
The first option would be totally uncompressed PCM, which is how music is stored on audio CD’s. While this is going to get you a bit for bit copy of the exact data on an audio CD, there is really no reason not to employ some space saving. This option is objectively inferior for this reason.
Lossless codecs are able to save space with zero reduction in quality, which makes them strong contenders if the goal is to archive music. Both FLAC and Apple Lossless are good options, though FLAC is more popular and arguably superior in terms of licensing. These codecs will squeeze some space savings out of the audio without sacrificing quality in any way. For a desktop application with modern hardware, lossless codecs are going to be a superior option.
While true audiophiles would sneer at the thought of anything less than a lossless copy, some of the more modern lossy codecs are truly impressive pieces of software engineering. Mp3 became a THE lossy standard because it didn’t have much strong competition way back in 1995 when it was first released. Mp3 at high bitrates compresses well and is nearly indistinguishable from a recording source without the use of extremely high end audio equipment. It has hung around for so long because it is “good enough” and has a great deal of market inertia behind it now. These days, there are simply better options. Ogg vorbis and Opus are two open formats that both deliver better audio at comparable bitrates when compared to Mp3. These formats are not patent encumbered, which make them solid options for commercial applications. Vorbis came first and was designed as a higher latency codec for music and multimedia audio applications. Vorbis has a large bitrate range (betweek 45kbit and 500 kbit per second) and is simply much stronger than Mp3 across the entire range. For telephony applications, for example, lower bitrates are perfectly capable of transmitting voice audio which requires less fidelity than a music audio recording. The IETF saw how well Vorbis did and thought that they could make it better. Opus was born. Opus has a substantially wider bitrate range than even Vorbis. Opus can limbo all the way down to 8kbit/s. Combined with a much lower algorithmic delay, Opus is ideal for Voice Over IP and other interactive mediums. What is even more impressive is that, when the bitrate is cranked up, it is objectively superior to alternative formats basically all the way up the bitrate scale.
I did some testing myself with my computer. While I do not have any truly high end audio equipment, my Logitech G930 has a reasonable level of audio fidelity and likely represents a level of audio fidelity slightly above the median across computer users. I acquired an audio source from a great 80’s band and converted the lossless FLAC files to Opus at various bitrates starting with 8kbit/s. I selected “Alone” which is one of my favorite tracks and has a high degree of range between quiet sections and blistering full-range instruments and vocals at once. The 8kbit sample was noticeably degraded in quality. There was obvious background hiss and muddled audio in general. It was clear what the song was, but any sort of fine fidelity just wasn’t happening. At 16kbit, I could very clearly make out all vocals but there was still a slight background noise issue on higher volume. 24kbit was where things began to get interesting. At this bitrate, I had a bit of difficulty noticing any quality degradation until the loudest sections came in. No background noise issues could be detected at any time. I didn’t do any testing beyond 32kbit because I simply couldn’t notice the difference between it and the source. When using random A/B testing, I was able to guess the 32kbit encode correctly only slightly better than average. This 32kbit sample came in at a whopping 865KB in size. Truly remarkable when compared against the more than 24MB source file. Below is a chart comparing the size of the various encodes I did against the source filesize.
From this angle, that looks pretty impressive to me.