A WAV file takes up a lot of space, but compressing it to MP3 means giving up part of the information. There is a middle path that requires no compromise on quality: lossless compression. The file gets smaller, and once decoded it returns exactly, sample by sample, the original signal.
Why audio barely shrinks with zip
Anyone who has tried compressing a WAV with an ordinary archiving program will have seen modest results. General-purpose algorithms look for repeated byte sequences, but in an audio signal identical sequences are rare: each sample differs slightly from the previous one. You need methods designed for the nature of sound signals.
The principle: predict and store the error
Lossless audio codecs exploit a simple observation: neighboring samples are strongly correlated. Knowing the previous samples, you can estimate the next one quite accurately.
Simplified, the process works like this:
- The signal is split into blocks of a few thousand samples.
- For each block the encoder computes a predictor, a formula that estimates each sample from the previous ones.
- Instead of storing the samples, it stores the residuals: the difference between the real value and the predicted one.
- Residuals are small numbers, often close to zero, and are encoded with a variable-length scheme that uses few bits for small values.
Decoding reverses the process: the prediction is recomputed, the residual is added and you get the original sample, bit-identical.
Exploiting stereo
In stereo files the two channels are often very similar. Many encoders try encoding, instead of left and right, their sum and their difference. If the material is nearly mono, the difference is tiny and compresses very well.
How much you save
The compression ratio depends on the material, not on the codec. Roughly:
| Material | Typical reduction |
|---|---|
| Speech with pauses | Very high |
| Acoustic, classical music | High |
| Dense electronic music, heavily compressed rock | Modest |
| White noise | Almost none |
The more predictable and dynamic the signal, the better it compresses. A master with very high loudness and very little variation, or a noisy signal, leaves the predictor little room. In many cases files end up around half to two thirds of the original, but it is worth checking on your own files.
FLAC and ALAC compared
FLAC (Free Lossless Audio Codec) is open, patent-free and supported by a huge number of players, operating systems and programs. It offers compression levels from 0 to 8: higher levels produce slightly smaller files and take longer to encode, while decoding remains fast at any level.
ALAC (Apple Lossless Audio Codec) does the same job and is built into the Apple ecosystem. Its code has been released under an open source license, so other players support it too.
In terms of quality the two are identical: both return the original signal. The choice depends only on compatibility with the devices you use.
File integrity
A practical advantage of FLAC is that it stores an MD5 signature of the original audio in the file header. With the official command-line tool you can check that the decoded file matches the original:
flac -t recording.flac
For an archive of recordings it is worth running this check periodically, for example after copying the files to a new drive. An error indicates a damaged file that should be restored from a backup.
Metadata
FLAC uses Vorbis-style comments, flexible and well supported, and can embed artwork. ALAC, inside an MP4 container, uses that ecosystem's tags. In both cases metadata handling is far more reliable than with WAV.
When to use lossless
- Music and recording archives: you save space without giving up anything.
- Sharing files with others when bandwidth is limited but full quality is needed.
- Backups of finished projects, alongside the session files.
It is not suited, however, as a working format inside a DAW that would convert it anyway, nor for streaming over slow networks, where lossy codecs remain more efficient. In my work I archive masters in FLAC and keep the original WAVs only for projects that are still open.
In short
- Lossless compression shrinks the file while returning a bit-identical signal.
- Codecs predict each sample and store only the prediction error.
- Savings depend on the material: speech compresses a lot, noise almost not at all.
- FLAC and ALAC have the same quality; choose based on compatibility.
- FLAC's MD5 signature lets you verify the integrity of an archive.