Digital Sound & Music: Concepts, Applications, & Science, Chapter 5, last updated 6/25/2013

69

5.3.8.4 Lossless Audio Compression

Lossless audio codecs include FLAC, Apple Lossless, MPEG-4 ALS, and Windows Media

Audio Lossless, among others. All of these codecs compress audio in a way that retains all the

original information. The audio, upon decompression, is identical to the original signal

(disregarding insignificant computation precision errors). Lossless compression generally

reduces an audio signal to about half its original size. Let’s look at FLAC as an example of how

it’s done.

Like a number of other lossless codecs, FLAC is based on linear predictive coding. The

main idea is as follows:

Consider the audio signal in the time domain.

Come up with a function that reasonably predicts what an audio sample is likely to be

based on the values of previous samples.

Using that formula on n successive samples, calculate what n+1 “should” be. This value

is called the approximation.

Subtract the approximation from the actual value. The result is called the residual (or

residue or error, depending on your source).

Save the residual rather than the actual value in the compressed signal. Since the residual

is likely to be less than the actual value, this saves space.

The decoder knows the formula that was used for approximating a sample based on

previous samples, so with only the residual, it is able to recover the original sample value.

The formula for approximating a sample could be as simple as the following:

∑

̂( )

( )

where ̂( ) is the approximation for the

nth

sample and is the predictor coefficient. The

residual ( ) is then

( ) ( ) ̂( )

The compression ratio is of course affected by the way in which the predictor coefficient is

chosen.

Another source of compression in FLAC is inter-channel decorrelation. For stereo

input, the left and right channels can be converted to mid and side channels with the following

equations:

( )

Values for mid and side are generally smaller than left and right, and left and right can be

retrieved from mid and side as follows: