594 Appendix G
waveform). The data are recognized by the .wav filename extension. Any audio file can
be compressed using lossy codecs, typically up to an 80% compression rate,
12
with the
original sound quality being lost forever, yet producing acceptable sound restitution,
depending on the music, audience, and utilization. See further on for this topic. In
contrast, lossless audio compression fully preserves the original CD quality. Two key
examples of lossless compression codes that can be used for music are the popular ZIP
(see further), which can achieve 10–20% compression, and FLAC (short for free lossless
audio codec), which can achieve over 40% compression.
13
In short, FLAC is based on
two algorithms: linear predictive coding (LPC)
14
and run-length encoding (RLE).
15
The
first makes it possible to decompose acoustic spectra into a reduced list of parameters,
which in the reverse implementation can faithfully reproduce the original sounds. Linear
predictive coding was originally developed for speech analysis, low bit-rate compression
and re-synthesis. Key applications of LPC include cellular telephony (GSM), speech
recognition, and electronically synthesized music. The principle of RLE is to replace
sequences of repeated codewords (called “runs”) with the codewords preceded by their
counts. For instance, the sequence XXXXXXXXXXYYYYYY is readily compressed
into 10X6Y. This provides additional sound compression, for instance with silent or
monotone passages. The LPC parameters are stored by means of Rice–Golomb codes,
which are described in Chapter 10. Next to FLAC, there actually exists a wealth of
lossless audio codecs with compression rates near 40% or better, such as: WavPack,
ALAC, Monkey’s Audio, OptimFROG, Shorten, WMA, LA, TTA, LPAC, MPEG4 ALS,
Real Lossless, Shorten, MUSICompress/WaveZIP, AudioZip, WaveArc, Pegasus SPS
(ELS-Ultra), Sonarc, WavPack, and RKAU. Several comparative-merit lists for these
different codecs are available.
16
Lossy data compression
17
turns out most useful in any application where the full
integrity of the original information does not have to be preserved. The key benefits
that outweigh integrity are manifold: reduced file sizes (or fuller use of available stor-
age or disk space); faster file transmission (or up- and downloading on the Internet);
faster encoding and decoding processing for real-time or streaming applications. Key
applications of lossy compression concern audio, images, and video files. Concerning
audio files, an underlying principle of lossy compression is based on psychoacoustic
12
Meaning that the size S of the compressed data is 20% of the size U of the uncompressed, source data.
Note that the general convention is to define the compression as the ratio S/U , not 1 − S/U , which scales
the opposite way as the ratio.
13
The compression rate is in fact dependent on the type of music source. It can be 30–40% for pop,
rock, techno, and other loud, noisy music, and 40–60% for quieter choral and orchestral pieces, see:
www.firstpr.com.au/audiocomp/lossless/#Links.
14
There exist many Internet sites and tutorials for LPC, see for instance: www.data-compression.com/
speech.shtml; www.answers.com/topic/linear-predictive-coding; http://cnx.org/content/m12473/latest/.
15
See: http://flac.sourceforge.net/features.html; www.answers.com/topic/flac; http://en.wikipedia.org/wiki/
FLAC.
16
http://wiki.hydrogenaudio.org/index.php?title=Lossless_comparison; http://flac.sourceforge.net/
comparison.html; www.compression-links.info/Lossless_Audio_Coding; http://members.home.nl/w.
speek/comparison.htm.
17
http://en.wikipedia.org/wiki/Lossy_data_compression.