Compression #3 - digital sound

To understand one crucial role of compression, which is to avoid digital clipping, you also need to understand a little bit(!) how sound is stored and processed in digital land.

Then and now

In analog land, when music was stored on tape and vinyl, the sound waves were truly waves, and they were captured and played by components that could reproduce the air pressure that is truly the nature of sound. Waves were at the start, they were stored as waves and reproduced as waves…

The digital revolution has changed that. We are now storing sounds (and images and anything on a computer) as bits: 0s and 1s. There’s no real in between (at least until quantum computers are mainstream but that’s another story!)

Storing sound

The way a wave is stored on a computer is by cutting it into discrete pieces of information usually by grouping 8, 16, 24 or 32 (and even 64) bits together. These are called bytes and they can store a maximum range of information, no more, no less. For 8 bits, we can store 28 values, so between 0 and 255. For 16 bits, 216 so 0 to 65535, etc.

A sound is stored by analyzing a wave in time and determining its amplitude, from 0 to x (depending on the number of bits used). The sample rate will determine how fast that analysis happens, it’s called “sampling” (taking a sample of the amplitude of a sound at a given time and storing it in a byte).

Sampling

Typically, a sound from a CD is sampled with 16 bits at 44.1khz, meaning there will be 44100 values (ranging from 0 to 65535) per second. There are all sorts of other sample rates and bit rates, but let’s keep it at that as our reference. Just know that the higher the sample rate and the closer the bits of discrete information are, thus more capable of a smoother reproduction of the initial sound wave. The higher the bit rate and the more discrete differences in amplitude (dynamics) we can store*.
But know that the 44100 range values between 0 and 65535 per second are more than capable of reproducing the waves that our ears are able to discern (that is unless you truly have golden ears, which might be the case of a truly gifted 0.000001% of the world population).

* The 16-bit compact disc has a theoretical un-dithered dynamic range of about 96 dB, however, the perceived dynamic range of 16-bit audio can be 120 dB or more with noise-shaped dither, an advance technique taking advantage of the frequency response of the human ear.

As you can see from the picture above, the values of the waves are transformed into discrete little samples, and these sample will only be able to store up to a maximum amplitude value. This maximum value is called 0 dB. dB is short for decibel and it’s the measure of amplitude of a sound (to note that it is not a linear scale, but a logarithmic one: A difference of 3 dB in a sound is generally perceived by the human ear as twice louder).
Every measure of sound level is always minus something… 0 dB being the absolute a sound can be stored, in 16 bits, it is going to be the value 65535. We go from 0 (which is -infinity) to 65535 (which is 0 dB).

Clipping

In digital land, there’s no way we can store more than 0 dB, because a byte of 16 bit will not be able to store more than that value of 65535. If a sound goes over this limit, it will be “clipped” meaning its value will still be stored as 65535.

This was not the case in analog land, when we were pushing an amplifier, it was distorting the sound but in a way that we’ve become accustomed to, what some people call the “warmth” of analog sound, this is especially true of tube amplifiers which were overheating and distorting the sound in very pleasing way. Of course, if you were truly going over a certain level you could also blow your amplifier and get a nasty sort of distortion. But in general, you could achieve a great sound with distortion, and indeed this has been used to great effect by every guitarist in the rock world, as Jimi Hendrix could have told you!

Now the problem is that in digital land, you cannot really push a sound over the limit, it will just be “clipped” and the result of it is a nasty sort of distortion that is not at all pleasing to the ears. Think high pitch noise that could come from a robot in a bad sci-fi movie, or something that is more like white noise and hissing dirt in your ears, not at all pleasing.

All of this to say that one crucial role of compression will be to avoid clipping and digital distortion. We will see in a next part how this is achieved with some audio example as well… stay tuned!

Leave a comment

    Add comment