Lossless Audio Formats

Introduction

As with anything that has more than one option (being the actual definition of "option") there exists several debates as to which lossless audio compression format is superior. However, without evidence to support their claims, people saying that one format is better than the other are not even noted. Especially subjective statements alike to "I like Monkey's Audio the best because it has a cooler mascot!" are completely ignored due to lack of credibility or pertinence.

Although a Microsoft Windows operating system is used by a high percentage of the average user, it is a less percentage of the experienced user. This fact must be entered into account as a lossless audio compressor was to become standard at the hydrogen audio forum for posting small sample wave files. In choosing which format to use, variables that were deemed of the highest importance were: free, open-source, highly available, cross-platform, stable and good documention. Open-source, cross-platform and a high availability were necessary due to the community environment where many operating systems are used by various members; free was necessary due to the fact that we are cheap, and it is unnecessary to have to pay for such a program, considering most are free anyways, and "stability" and "good documentation" were preferential due to the nature of a community with inherently impressive computer programming abilities. The only format that even comes close to fitting those characteristics is FLAC.

FLAC

Short for Free Lossless Audio Codec. FLAC is open-source software, and as open-source, it has the possibility (high probability) of being accessible to a large amount of users. FLAC is freely available and supported on most operating systems, including Windows, "Unix" (Linux, *BSD, Solaris, OS X, IRIX), BeOS, OS/2, and Amiga. There are build systems for autotools, MSVC, Watcom C, and Project Builder. Additionally, FLAC provides the most generous amount of documentation of all lossless compression formats, which will allow for future stability - both Monkey's Audio and Shorten lack this feature.

Notable features of FLAC:
  • Lossless: The encoding of audio (PCM) data incurs no loss of information, and the decoded audio is bit-for-bit identical to what went into the encoder. Each frame contains a 16-bit CRC of the frame data for detecting transmission errors. The integrity of the audio data is further insured by storing an MD5 signature of the original unencoded audio data in the file header, which can be compared against later during decoding or testing.
  • Fast: FLAC is asymmetric in favor of decode speed. Decoding requires only integer arithmetic, and is much less compute-intensive than for most perceptual codecs. Real-time decode performance is easily achievable on even modest hardware.
  • Hardware support: Because of FLAC's free reference implementation and low decoding complexity, FLAC is currently the only lossless codec that has any kind of hardware support.
  • Streamable: Each FLAC frame contains enough data to decode that frame. FLAC does not even rely on previous or following frames. FLAC uses sync codes and CRCs (similar to MPEG and other formats), which, along with framing, allow decoders to pick up in the middle of a stream with a minimum of delay.
  • Seekable: FLAC supports fast sample-accurate seeking. Not only is this useful for playback, it makes FLAC files suitable for use in editing applications.
  • Flexible metadata: New metadata blocks can be defined and implemented in future versions of FLAC without breaking older streams or decoders. Currently there are metadata types for tags, cue sheets, and seek tables. Applications can write their own APPLICATION metadata once they register an ID.
  • Suitable for archiving: FLAC is an open format, and there is no generation loss if you need to convert your data to another format in the future. In addition to the frame CRCs and MD5 signature, FLAC has a verify option that decodes the encoded stream in parallel with the encoding process and compares the result to the original, aborting with an error if there is a mismatch.
  • Convenient CD archiving: FLAC has a "cue sheet" metadata block for storing a CD table of contents and all track and index points. For instance, you can rip a CD to a single file, then import the CD's extracted cue sheet while encoding to yield a single file representation of the entire CD. If your original CD is damaged, the cue sheet can be exported later in order to burn an exact copy.
  • Error resistant: Because of FLAC's framing, stream errors limit the damage to the frame in which the error occurred, typically a small fraction of a second worth of data. Contrast this with some other lossless codecs, in which a single error destroys the remainder of the stream.
What FLAC is not:
  • Lossy: FLAC is intended for lossless compression only, as there are many good lossy formats.
  • SDMI compliant: There is no intention to support any methods of copy protection, which are, for all practical purposes, a complete waste of bits. (Another way to look at it is that since copy protection is futile, it really carries no information, so you might say FLAC already losslessly compresses all possible copy protection information down to zero bits!) Of course, we can't stop what some misguided person does with proprietary metadata blocks, but then again, non-proprietary decoders will skip them anyway.

Monkey's Audio

One of the more popular lossless audio compression formats is the Monkey's Audio Compressor, or MAC. We're not making this up. The FAQ makes mention of the name and file extension by saying, "In hindsight, maybe it's a stupid name. Then again, maybe you just need to lighten up". The compressor can trade off encoding speed for compression ratio, though it's always in the neighborhood of 1.5:1 to 3:1, depending on the source material. The source code is available, but there is a license agreement which states you can't make commercial products with MAC unless you discuss terms with the developer first.

Monkey's Audio is recognized by many Windows users as the lossless audio compressor of choice. This format has, in general, the greatest compression ratio with average speed performance - both large factors in deciding the format to use. However, Monkey's Audio is not open source and not available for any other operating system (note: a Linux port is currently in the works). For a community setting, this lack of cross-platform availability is most important, which renders Monkey's Audio extremely undesirable. But, for personal use by a Windows user, Monkey's Audio is not rivaled...yet. If you know that the only person needing access to your lossless files is you, then I can honestly recommend the use of Monkey's Audio. Recently, the source code of Monkey's Audio has become available to the public, and I think this show of faith by matt, the developer of Monkey's Audio, can have nothing but guaranteed future support by the community.

Speex

Another open-source, patent-free audio compression format, Speex is targeted at compressing speech to very low bit rates - in the 2 to 44 kilobit per second range. It includes lots of good features, such as packet loss concealment and voice activity detection, and offers a VBR mode as well as the ability to change bit rate on the fly. Speex is based on CELP and is designed to compress voice at bitrates ranging from 2 to 44 kbps.

Speex's features:
  • Narrowband (8 kHz), wideband (16 kHz), and ultra-wideband (32 kHz) compression in the same bitstream
  • Intensity stereo encoding
  • Packet loss concealment
  • Variable bitrate operation (VBR)
  • Voice Activity Detection (VAD)
  • Discontinuous Transmission (DTX)
  • In-progress fixed-point port
Note that Speex has a number of features that aren't in other codecs such as intensity stereo encoding, integration of multiple sampling rates in the same bitstream, and a VBR mode.

WavPack

The WAV standard was developed by Microsoft and IBM nearly two decades ago, and is the de-facto standard for basic Windows sounds. WAV files are usually uncompressed, but a compressed standard achieves a 4:1 compression ration through an the lossy ADPCM (Adaptive Differential Pulse Code Modulation) scheme that drops each sample down from 16 bits to 4 bits.

There are several other compressed WAV formats, such as GSM, ALAW, and ULAW, but these are even less popular than ADPCM.

Like other lossless compression schemes the data reduction varies with the source, but it is generally between 25% and 50% for typical popular music and somewhat better than that for classical music and other sources with greater dynamic range.

WavPack also incorporates a unique "hybrid" mode that provides all the advantages of lossless compression with an additional bonus. Instead of creating a single file, this mode creates both a relatively small, high-quality lossy file that can be used all by itself, and a "correction" file that (when combined with the lossy file) provides full lossless restoration. For some users this means never having to choose between lossless and lossy compression!

WavPack 3.97 Features:
  • Completely free and open source!
  • Unique hybrid mode (provides high quality lossy + "correction" file)
  • Perfect for archiving audio (16, 20, and 24-bit, mono or stereo)
  • Easily the fastest program of its type, yet gives good compression
  • Small, efficient executable (no large programs or dlls to install)
  • Intuitive command line interface (with wildcards and destination directory)
  • Selectable raw mode for any non-wav files (including CD image files)
  • Seekable Winamp plugin with ID3v1, APEv2 and ReplayGain support
  • Cool Edit file filter with 24-bit and "extra information" support
  • Complete piping support for WAV and RAW audio data
  • Fully backward compatible to WavPack 1.0
  • Create self-extracting archives
  • Windows frontend available
  • 32-bit error detection

OptimFrog

OptimFROG is a closed source lossless encoder for Windows, and Linux x86. Given the same time to encode a file as MAC (Monkey's Audio), OptimFROG produces output of a very similar size. OptimFROG also has modes which spend much more time encoding (up to 15 times longer than in its normal mode), in return for slightly smaller files (very rarely more than 0.5%). The downside to using these modes is that OptimFROG is symmetric - it takes the same time to decode a file as it does to encode. Thus, the high-compression modes are not suitable for archiving music which you will want to play back.

Pros of OptimFrog:

At high levels, compresses files better than any other current lossless encoder (only "LA" is better and fastest on highly compressed files)

Cons of OptimFrog:
  • Very slow to encode and decode highly compressed files
  • No source available

LPAC

LPAC is a codec (coder / decoder) for lossless compression of digital audio files. "Lossless" means that any compressed file can be decompressed in a way it will be bit-wise identical with the original. This is the main advantage of LPAC compared to lossy formats like MP3, WMA or RealAudio. On the other hand, lossy codecs can achieve higher compression ratios. For example, MP3 at 128 kbit/s achieves a (fixed) compression ratio of 11, whereas LPAC's compression ratios range from 1.5 to 4, strongly depending on the audio material. Typically they are around 2 for pop music and 2.5 for classical music. This may not seem much, but remember you will get back every single bit, no matter how often you subsequently compress and decompress a file. It is true that general archivers (Zip, LZH, gzip) are lossless, too, but they often achieve nearly no compression on audio files.

LPAC is your choice if you want to save disk space without any quality drawbacks introduced by lossy codecs like MP3. The LPAC file format (*.PAC) is designed to be compatible and lossless across different platforms and processors. Using Windows, you can play your compressed songs using the Winamp plug-in.

Features
  • Totally lossless compression of 8 bit, 16 bit, 20 bit and 24 bit wave files (mono / stereo)
  • Cross-platform support for Windows, Linux and Solaris
  • Direct playback of LPAC files (*.PAC) with Winamp plug-in
  • CRC checksum to ensure lossless processing (since codec 2.0)
  • Encoding much faster than real time (4x - 12x on a 500 MHz Pentium).

Shorten

Owned by Cambridge-based SoftSound, Shorten is a proprietary waveform coder that offers both lossless and lossy compression modes. The lossy compression only offers compression ratios of 3:1 to 5:1, and is not very popular compared to more robust lossy compression schemes like MP3, AAC, or WMA. The lossless mode is a bit more popular among audio professionals and sound enthusiasts, with a typical compression ratio of about 2:1 for 16-bit audio.

Shorten is currently the choice format for lossless trading among the bootleg community. This format became standard due to the lack of choices available when the community began, and so, when weighed with factors such as continuity of the community and the burden of across-the-board adoption, the change from shorten may seem unnecessary - shorten's performance is acceptable to them. However, this situation is not typical, and the features that are lacking in shorten cannot be denied in the decision making process.

Conclusion

I think it must be noted that despite the features of each format, all lossless audio compression will remain true to the original wave. So whatever format you choose to use - whether FLAC, Monkey's Audio, Shorten, etc. You are guaranteed that compression is perfect.

Related Links
top