Tuesday, 6 August 2013

Digital Audio - Lossy compression

Lossy codecs save space on storage and speed download times, MP3 reduces files to 1/12th, WMA to 1/24th of their uncompressed size. Subjectively and very often, people say they cannot hear the difference between a CD, a 128kbps MP3 or a 64kbps WMA stream. But this is when they are listening on pitifully small speakers, for example on a laptop, or on poor earphones plugged into an MP3 player. But play the same tracks on a better hifi system and the differences are clear. Play the same track from a CD and the difference is very striking. Play the same tracks from an HD Audio download (24bit/96kHz) studio master and the differences are dazzling.

The problems with lossy compression are many, and mostly based on dubious psycho-acoustic assumptions:

1. The removal of all audio information above a certain frequency - “can’t hear it anyway”

2. Stereo to mono conversion completely or above a certain frequency - “stereo is only heard at mid frequencies”

3. Phase collapse, the elimination of phase differences between channels, completely or above a certain frequency - “blurred instrument positioning in the sound stage does not contribute to musical appreciation”

4. Frequency masking, loud tones masking lower volume information in nearby frequencies - “just lets the main music come through”

5. Temporal masking, loud tones that mask lower volume information that precedes or follows the masking content - “just lets the main music come through”

6. Echo, the insertion of unwanted information before and after sharps transients - “the ear doesn’t hear this small change”

Subjectively people find that WMA is better than MP3 is better than Real Audio lossy compression. But technically they are all bad. This can be seen by looking at the spectra of various test sounds before and after compression.

The first spectra show a sound clip original (in WAV uncompressed format) versus the same clip of pink noise in MP3, Real Audio and WMA reproductions.

Screen Shot 2013 08 06 at 13 51 06

Here's another example:
Screen Shot 2013 08 06 at 13 51 50

The MP3 output looks ugly, with low pass filtering above 10kHz, but look at the added noise round the low level tones! The Real Audio has better channel separation and frequency response up to above 13kHz, but the noise floor is up to just -60dB, close to the right channel levels. WMA compression delivers clean stereo separation and high frequencies above 18kHz, but a slightly increased noise floor.

No comments: