Thursday, December 26, 2019

THE DIFFERENT TYPES OF AUDIO COMPRESSION

Before we can get started with compression types, there are 3 aspects that we should understand -

1. Sample rate

2. Bit depth

3. Bit rate

Let's talk about Sample Rate first. The sample rate, is the number of samples per second. It is also referred to as Sample Frequency, higher the sample frequency, the closer it is to the original analog sound. It is usually measured in Hertz (Hz). The most relatable one that we've all come across is the CD which is recorded at 44.1 khz which is twice the amount of human hearing. This is done in order to prevent the loss of data during the sampling process (from analog to digital).

Next comes Bit Depth, which is directly proportional to the dynamic range. It is the number of bits/sample. Higher the bit depth, more is the dynamic range which eventually leads to a better audio quality. The most commonly used ones are the 16bit and 24 bit.

Finally coming to Bit Rate, it is number of bits (data) encoded per second. It basically determines the streaming quality. It ranges from 64-320 kbps for MP3s & goes upto 1411 kbps for WAV format. It is calculated as sample rate * bit depth * no. of channels.

Now that we're done with these 3 aspects, let us take a look at the different types of compression that we generally come across.

There are basically 3 categories -

1. Uncompressed

2. Lossless

3. Lossy

Let's take a dive into each one of these -

1. Uncompressed

The original (digital) data as such is referred to as uncompressed format. They are the most real and raw version of the analog sound signal. Examples of this include WAV & AIFF. Since the files do not undergo any kind of compression, there is no loss of information, which results in the highest quality audio and is of a fairly large size.

Music producers / Mix engineers / Mastering engineers and for other studio related purposes, the WAV format is the benchmark as it doesn't lose it's quality even when there is some editing / changes done to it.

Fig 1 - Spectrum of a .WAV file


2. Lossless Compression

Lossless files are a stripped down version of the uncompressed format. The only difference between this and the uncompressed is that the lossless format occupies lesser space without much loss in quality.

Though it reduces the data in the process of compression, the audio quality remains unaffected. Lossy compression is also called irreversible compression. Examples of this include FLAC & ALAC.

3. Lossy Compression

This type of compression basically reduces all the three aspects of the audio sample. At the same time, some of the information is lost which results in degradation of the audio quality, depending on how much data is lost, the quality also differs.

Fig 2 - Spectrum of a .MP3 format
 From the image you can see that some of the frequencies are cutoff (compared to .WAV spectrum in fig 1), this happens during the compression process. It usually removes the frequencies that are out of the human hearing range (i.e. 20 - 20khz). This helps in reducing the overall file size.

Lossy compression is also called irreversible compression. Advantage of this is that it takes very little space for storage compared to other 2 types of compression. Example of lossy formats include MP3,WMA etc.

Therefore, there is no format which can be completely ignored, they all have their uses depending on the purpose. If you're in a professional environment, then the WAV format would be your go to choice, if you're just going to listen to music & don't mind much about the storage, then your best bet would be FLAC/ALAC and if space happens to be a constraint, then MP3 is the most ideal format. So choose wisely!

I hope you got something out of this and if you have any questions, do drop them in the comments. If you enjoyed reading it, then please do share it. In the upcoming blogs, i'll be reviewing some of the gear that i own, so stay tuned!


References :
Sample rate & Bit Depth
Understanding Audio Quality 1
Understanding Audio Quality 2

2 comments: