The goal of all data compression is to reduce file size. Originally the value of this was conservation of hard drive space. If you’ve used WinZip or Stuffit you’ve already compressed and uncompressed files. But in recent years music distribution over the Internet has made data compression very important: small files can be transferred much more quickly and easily than large files.
Word processor documents and spreadsheets are relatively easy to compress; some codecs use simple substitution of a single character or symbol to represent a common word or phrase (for example, the word “The” might encoded as “^” which is a 2/3reduction in size).
Typical audio files such as AIFF or WAV, though, are much more difficult to encode and decode. First of all, each bit of audio data represents some element of the original sound’s timbre, frequency or amplitude. It can’t easily be reduced using a simple replacement scheme. Second, audio files must be decoded and played in real time – something that’s not required of a compressed document, so the codec must be able to act quickly on the data as it streams through.
In the late 1990s and early 2000s, Internet users and consumers satisfied themselves with a number of so-called “lossy” codecs such as MP3 and AAC, which use sophisticated algorithms to discard selected bits contained in the original audio that have a minimal impact on the overall sound. Some audio professionals have been confused and frustrated by the widespread acceptance of these formats because they do deliver lower-quality frequency response and dynamic range than the typical CD. The goal has been to produce algorithms to mathematically reduce audio data in a way that doesn’t lose any of the information.
Now several such (“lossless”) audio codecs do exist. They have achieved compression rates of up to 50% and can perform well on a number of hardware devices and computer software.
Lossless audio compression uses a combination of mathematical strategies to accomplish its goal. Many begin by using “prediction,” a somewhat challenging concept: if the values of future audio samples can be predicted, then it is only necessary to transmit the rules of prediction along with the difference between the estimated and actual signals. In other words, the codec analyzes the incoming data, guesses what the following data might be, then stores only the portions in which the “real” signal differs from the “predicted” signal.
Lossless codecs also use a combination of finite impulse response (FIR) and infinite impulse response (IIR) filters to compensate for the wide dynamic range of musical material (MP3 and other “lossy” codecs use FIR filters, which, in common implementations, don’t capture dynamic shifts at high frequencies, which is one element of their “squashed” sound).
Finally, lossless codecs transmit signal at a variable transfer rate, thus making sure that full-bandwidth signal passes while low-bandwidth material doesn’t clog the stream with a bunch of zeros. Extensive buffering (up to 75ms) helps pass this data to the playback device. In addition, most codecs employ a means of collecting audio data that is similar on multiple tracks – room ambience or cymbal overtones, for example – and compacting them into one data stream. This is called “Entropy coding,” a term you don’t really need to remember.
Among several lossless audio codecs are: Free Lossless Audio Codec (FLAC), which is a popular open source code that groups like Phish and Metallica use to post audio files on their websites; Monkey’s Audio, also popular but Windows-exclusive and dependent upon CPU speed to deliver fast decoding; Meridian Lossless Packing, the officially supported codec for DVD-Audio by the DVD Study Group; WavPack, which uniquely can generate a “lossy” file (like an MP3) plus a “correction” file that restores the lost data. In spring 2004, Apple entered the scene with Apple Lossless Audio Codec (ALAC), which is supported by iTunes version 4.5 and offers iPod users the ability to listen to tracks that have the fidelity of uncompressed audio but require a little more than half the storage space.