Making the Least of It

Image placeholder title

If you've ever tried to conserve disk space by archiving old recording projects, you probably know that standard compression schemes like ZIP and RAR don't work well on audio data. These schemes shrink file sizes by minimizing data redundancy and work best with the types of repeated patterns common in file formats such as Microsoft Word's DOC format. Although audio signals often consist of repeating waveforms, the repetition is represented in a manner that is completely alien to standard data-archival programs. At best, you can expect percentage savings that are in only the single digits.

Image placeholder title

FIG. 1: The most important part of configuring a FLAC encoder is choosing the compression level.

Using a lossy audio codec such as MP3 or Ogg Vorbis will result in a smaller file, but the trade-off is a permanent loss of data and a file that will never sound as good as the uncompressed original. Most lossy codecs work by throwing away components of a sound file that you wouldn't hear anyway (see “All Is Not Lost” in the October 2006 issue of Electronic Musician for an introduction to lossy compression). But unless you carefully tweak the resulting file, you're more than likely to end up with a file that is noticeably inferior to the original.

Enter the lossless codec. Lossless codecs are functionally equivalent to compression schemes used to create ZIP and RAR files but use data-coding methods optimized for audio. Linear predictive coding (LPC), for example, saves bits by “predicting” what future sample values will be by looking at previous samples. Run-length encoding (RLE) involves using the same number to represent repeated values (such as those of a long passage of silence). The resulting files take up significantly less disk space than the uncompressed versions — achieving a savings of 40 to 60 percent is quite normal — and the compressed files sound identical to the uncompressed one. You can even convert a compressed file back into a WAV or an AIFF file that is bit-for-bit identical to the original because all the original data is intact.

Just as television has moved from black-and-white to color to HD, lossless compression is rising in the audio world. All industry pros should therefore know how to package their mixes into a high-quality portable file.

Meet the LACers

By all accounts, the Shorten format, an open-source format developed most recently by Wayne Steilau and Jason Jordan (for complete developer contact information, see Web Clip 1), was the first method of lossless compression to make it to market. Available as early as 1993, it's still used widely for live-concert trading among jam-band fans, most notably at the concert trading hub of For most other uses, however, it has fallen behind newer counterparts such as Josh Coalson's Free Lossless Audio Codec (FLAC), which was released in 2003 and has since garnered the most widespread hardware and software support of any lossless codec. With few exceptions, any platform that incorporates any sort of lossless compression supports FLAC. The freely available source code makes it easy for interested developers to integrate FLAC into their products, so it's by far the most future-proof of the available formats.

Image placeholder title

FIG. 2: Very high compression levels take much longer to encode but produce only a minimal decrease in file size.

Although FLAC is a command-line program, graphical front ends such as Kevin Athey's MacFLAC are available for most operating systems. FLAC provides a tremendous number of intimidating text commands, but the only one worth worrying about is the compression level, which is specified by a number between 0 and 8. The resulting sound quality is the same for all levels, but higher values give you smaller files. You are usually able to choose this setting with a slider that's on the Preferences page of your encoder's front end (see Fig. 1). The highest compression levels take much longer to encode yet give only minimal returns regarding file size (see Fig. 2). Further, because they require more processing power to decode, some portable playback devices can be picky about the compression levels they'll support. In general, the best values to use are between 4 and 6.

Even though FLAC has the most widespread support, Apple's Lossless Audio Codec (ALAC), a proprietary format introduced in a 2004 update to iTunes, has the greatest market share. Support in popular consumer packages such as iTunes, QuickTime, and the iPod has propelled ALAC to the forefront of lossless digital audio. Indeed, to put iTunes into high-definition overdrive, just choose Apple Lossless as the audio format in the program preferences; there are no compression options as there are with FLAC. Note that Apple lossless files share the .m4a file extension with AAC, a lossy compression format also favored by Apple.

Who, What, Where

Like most modern media formats, lossless codecs usually include robust support for tagging, a method of storing additional information about the audio (metadata) inside the file. The most useful metadata fields are the basics (song name, album title, release date, and so on), but the tag can also hold more-esoteric elements such as URLs, pictures, and even more audio. In fact, because most lossless codecs were developed well after MP3, they often correct some of the flaws of the metadata implementations used by MP3. For example, newer formats often allow custom field names and multiple values for a single field. Storing large audio archives in metadata-rich formats makes organization a breeze. Instead of agonizing about whether to put a TR-808 bass-drum sample into the Drums folder or into the Hip-Hop folder, you can just enter both terms into the metadata and have the file show up in a search for either.

Using lossless files can be a savvy alternative to MP3 files, especially if you're trying to promote your studio's high production values or pristine sound quality. ALAC is particularly useful for these purposes, because it will play back seamlessly on any computer that has QuickTime or iTunes. Downloading files may take longer than with MP3, but for your listeners to get the full experience of hearing your high-resolution mixes, it's important to give them the option of listening to lossless files. ALAC's increasing popularity is perhaps best demonstrated by Apple's AirTunes, a popular home-audio streaming product that wirelessly connects your computer to your home stereo using an AirPort Express router. AirTunes will automatically transmit all audio in ALAC format to avoid bandwidth hiccups.

Similar bandwidth savings could be realized in long-distance collaborative projects carried out over the Web. But before sending a large batch of files to a production buddy, make sure that he or she has a way to access or decompress them. At the moment, lossless audio compression formats are not well supported by your average DAW. Apple Logic supports saving as ALAC from the File Export menu, and the open-source program Audacity, originally developed by Dominic Mazzoni and Roger Dannenberg, does the same with FLAC. More importantly, Ableton Live has supported FLAC import since version 5. Considering the impressive metadata capabilities of that format, it's safe to say that a carefully tagged sample library in FLAC format would be a tremendous addition to any Live-based studio environment.

The best support, however, comes from the fledgling sequencer Cockos Incorporated Reaper, which can import, export, and even record to FLAC. Users of other software will want to keep their session audio in their program's native format but should consider storing exports, mixes, and final products using lossless compression because of the metadata management possibilities. All the necessary conversions can be handled by power tools like iTunes, illustrate's dBpowerAmp, and Peter Pawlowski's foobar2000.

Transmission Complete

MP3 format will be with us for some time to come; even the multitude of technically superior competing lossy formats hasn't managed to unseat it. But for audiophiles and professionals alike, lossless is the only sensible option at this point. Large hard drives are cheap enough to allow storage of lossless audio in ways that even five years ago weren't financially sensible. What's more, lossless codecs offer complete format portability: because no data is ever discarded, there's nothing to stop you from converting to new formats as many times as you want, and you can always go back to uncompressed WAV or AIFF if needed.

As media technology expands, new technologies are developed and new formats emerge. But in the audio world, the past ten years have brought about a significant decrease in quality. For those surfing the bleeding-edge of audio, lossless audio compression can not only be a powerful tool but it also puts us one step closer to restoring widespread use of high-resolution audio.

Vijith Assar works at the Music Resource Center in Charlottesville, Virginia.