Family Encyclopedia >> Electronics

How does audio compression work and what is “lossless” audio?

Just this week, Spotify started testing "lossless" audio files. But what exactly is “lossless” audio and how does digital audio compression work?

ContentsHow does audio compression work?BitratePsychoacousticsWhat is "lossless" audio?Conclusion:Can you tell the difference?

How does audio compression work?

How does audio compression work and what is “lossless” audio?

Bitrate measures the number of bits used to encode a single second of audio. For example, if we use low-quality coding at 8 kilobits per second (kbps), our algorithm is limited to using only 8 kilobits of data to describe each second of audio. It's like trying to describe a color photograph with just a few hundred pixels. You might get the right strokes, but overall you'll have a very degraded image. If we use a higher quality bitrate like 192 kbps, we have plenty of room to cover the nuanced details. Going back to our photographic example, we now have enough pixels to describe the different lights, darks and colors in an image. A high bit rate alone does not determine the quality of a recording, but a low bit rate can seriously limit the output quality.

Psychoacoustic

How does audio compression work and what is “lossless” audio?

Psychoacoustics is the science of how the brain understands sound. By manipulating known quirks in the way humans perceive sound, compression algorithms can intelligently remove details that most human ears won't miss. The goal is to "round off" information that won't change the perceived audio quality of a track, judiciously removing only unimportant information.

For example, you may know the typical range of human hearing is between 20 Hz and 20 kHz. Obviously, sounds outside this range can be removed. Additionally, the most detailed range of human hearing is between 100Hz and 4kHz, and removing quiet sounds outside of these frequency ranges does very little damage to the quality of a recording. A similar trick can be done with very contrasting sounds. If a very loud sound and a very quiet sound are playing at the same time, the quiet sound is much more difficult to perceive than it would be alone. Encoders take advantage of this "sound masking" to remove low sound, saving bits.

Frequency can also impact how we perceive sounds. For example, a lingering low-frequency drumbeat tends to drown out the more delicate, high-frequency harmonics of melodic instruments. And sound masking is particularly effective above 15 kHz, where human hearing is generally less sensitive initially.

Common audio compression schemes such as MP3 take advantage of all compression possibilities while trying to stay as faithful to the original recording as possible. Of course, some people think that removing these frequencies seriously damages the recording. This is why lossless compression standards exist.

What is "lossless" audio?

How does audio compression work and what is “lossless” audio?

The goal of lossless audio compression is to reduce file size while leaving the original audio intact. These codecs do not use any of the permanent compression techniques above, instead focusing on fully reversible data compression methods. They use lossless compression techniques borrowed from file compression algorithms like ZIP to remove redundant data while preserving the integrity of the underlying information. Two popular lossless audio codecs – FLAC and Apple Lossless (ALAC) – both use ZIP compression-based schemes.

Focusing on data compression only means preserving many details that MP3 and other lossy standards would erase. If you have sharp ears and a high-quality listening setup, the difference can be palpable.

Lossless compression isn't just good for listening:it's also a great storage tool. Just as you wouldn't want a 72dpi JPG to be the only digital copy of Ansel Adam's photographs, we don't just want 128kbps MP3s of "Kind of Blue." Lossless standards like FLAC allow us to efficiently store audio without throwing away potentially valuable data. They also make it easier to remaster and redistribute that audio, because starting with uncompromising masters means a higher quality finished product.

Conclusion:can you tell the difference?

Lossless audio formats allow for better sound recordings. But sometimes the differences between a high quality MP3 file and a lossless file are almost unnoticeable, especially to an untrained ear. If you want to see if your headphones (and ears) are sharp enough to tell the difference, NPR has a fun test; Just keep in mind that headphones and cheap laptop speakers won't be able to reproduce the subtle differences between lossless audio and MP3s. For a more serious analysis of codecs, check out SoundExpert Encoder Ratings.