Sample Rate, Bit-Depth & Bitrate

To be sincere, I researched on this article for about a week to really come up with an idea of what to write, there is a lot going in analog to digital conversion which I can’t cover in this article, but I will try my best to explain and simplify on the terms people find confusing in audio sampling.

Do you ever think of the way a computer store information, remember, someone like you built a computer system, Oh I forgot to say someone smarter than you. A computer can’t store a continuous signal (Analog signal) because they have a finite number (they store discrete value) of capacity, let me expound on this.

Think of a continuous signal has an infinite number, the possible values each digit can have is infinite, at any point in time an analogue signal and can be sampled to a certain level, that is when sampling occurs, it gets value at each instantaneous point. To be sincere, you do not need all this techy explanation to understand this, I will explain in more simpler terms for those who want to have at least an idea on how sampling happen.

SAMPLING

As I said earlier, Computer can’t store infinite number, so an audio signal be it your voice or any other audio material is first converted into a digital signal by sampling every point in time of the analogue signal.

This process allows us to sample a different bunch of discrete number to represent a snapshot of the original audio signal at a rapid rate.

When an analogue signal is converted; it is transformed into a continuous, discrete sequence and then interpolated the signal back to a continuous function, the result you will get depends on the sample rate of the original sample itself.

The sample rate determines the sampling quality and this is how it is done: Let’s say we are sampling an audio signal at 20hz, at 20hz means a sample is taken at 1/20th of a second, that is 50 milliseconds, how did I get that, 1/20 = 0.05 and a millisecond is 1000th of a second, then the math is pretty simple, 0.05 x 1000 = 50 milliseconds, for every 50 milliseconds a sample is taken, this boils down to the sample rate of the original audio signal.

Let’s take another example, to sample an audio signal that as the frequency of 20khz, sampling must take place twice at the rate of the highest frequency. Why? Probably because all other frequencies are low, taken care of the highest one at first sample will automatically take care of the low ones at the second sample, Henry Nyquist studied this theorem, called Nyquist Sampling Theorem, study more about the theory here if you want to go deep into how things work.

BIT-DEPTH

There have been so much said about Bit-depth, and this took me time to find a nearly perfect answer, when we sample a signal (digitalise), we first sample the signal then quantise the signal, then quantisation adds noise, in a simple term.

The noise on a bit depth of let’s say 5 bits is much higher than that of 10 bits and so on when you have a bit depth of 16 bits or 24 bits it makes no difference because it is almost inaudible.

This brought us to the simple expression: The number of bits determines how much noise and the noise floor, if you want to read more on this, I have compiled a list of sources, which you can get more in-depth view of how this works, if you just want to have some idea of how it works, I guess my article is okay for a start.

BIT-RATE

In the world of the digital era, things have been easy to use, and digital technology has emulated the analogue way of doing things.

What Is Bitrate?

I guess most people have probably heard of the term “bitrate”, but the problem is that most people do not get how it works theoretically. Let me simplify this, Bit are compose of Ones and Zeroes and are the smallest unit of data that a computer can store, Rate is the frequency at which one thing is measured or recorded against another thing.

In a simplified manner, a Bitrate refers to the number of bits that can be transmitted (transferred) or received per second. Simple right!

In Mp3, Ogg or any compressed file format, bitrate is used to encode the number of bits to be transmitted into the particular audio aspect, it is usually measured in kbps (kbps stands for kilobits per second and note to be confused with kilobytes per second ).

Why Is MP3, OGG or Any Other Lossy File Format Smaller In Size?

Mp3 is an example of a lossy audio file format, it is a compressed version of a lossless audio data, it is used because it helps in retaining a similar copy of an uncompressed audio file when a compression is performed on the audio data, reducing the size drastically whilst not reducing the sound quality or not noticeable.

Should You Use a Lossy/Compressed Audio File Format?

When we refer to the term “Lossy”, it means that the file has been compressed to reduce the file size on our hard-disk or storage medium. When an audio data is compressed, the compression deletes chunks of data without really been obvious, so it is advisable to use a lossy format if you want to save some space on your storage medium, especially if you are just a regular guy that listen to music on devices.

Taking a simple scenario: You have a 24GB iPhone and you decide on using a lossless audio file format (not compressed) of about 300mb in size, imagine having 50 tracks on your phone, that is about 14.6GB, holy shit!!!. It’s sad that an iPhone storage is not extendable, maybe you would opt for another 24Gb iPhone, perhaps that’s not the case for most user, with a lossy file format like an mp3 or Ogg, you can save more, and I mean more space on your medium.

Bother less if you are not a music producer, you are already using a lossy audio file format. If you want to know how to calculate bitrate, audio file size, sample rate, then use our online calculator or just read more below on how the calculation is evaluated.

Calculating a Lossless Audio File Size

A lossless audio file format is usually written as an uncompressed audio file sound Interchangeably, but that does not mean it doesn’t undergo any compression. It preserves audio data, so the audio is the same as the original audio data, this might sound confusing, remember that lossless does not lose information when compressing and lossy loses information when compressing. Simple!

The formula for calculating a lossless audio file is: (Sample Rate x Bit Depth x Time) x Channel, where the channel can be Mono and Stereo basically

Remember sample rate is the number of samples you take per sec, usually represented in Hz, Bit-depth corresponds to the number of resolution of each sample and the time is the duration of the recording multiplied by the number of channels, if it is mono, then that’s multiplied and if it is stereo, it is multiplied by 2,

Example 1:
1.) A C.D recording is said to have a sample rate of 44.1Khz, a bit-depth of 16, calculate the audio file size of the C.D in Megabyte(M.B) if it is recorded in 5 minutes.
Note: C.D-D.A is in stereo, using the left and right channel, the amount of the audio per second is multiplied by 2.

Solution
i) 44.1 KHz, is first converted into Hz, 44.1 x 1000 = 44, 100
ii) Bit-depth = 16
iii) Length of time = 5 minutes, converting is 5 x 60 =300 seconds
iv) Number of channels = Stereo (2)

Using the formula

(Sample rate x Bit-depth x Time) x No. of Channel = (44, 100 x 16 x 300) x 2 = (211, 680, 000) x 2 = 423, 360, 000 bits

Huh, why the huge number? no worries, the cumulative size is in bits, we need to convert to bytes, then convert to K.b, and then M.b.

To convert to Bytes, we divide by 8, why? Because a byte contains 8 bits, simply right!!!
423, 360, 000/8 = 52, 920, 000 bytes.

One more step to go, we need to convert it to Mb, since that is what the question stated.
We can’t bump and divide by 1024, we rather convert to Kilobytes and convert to MB, or we divide by multiplying 1024 x 1024
52, 920, 000/ 1024 x 1024 =52, 920, 000 / 1, 048, 576 = 50.47 Mb

Example 2:
2.) An audio file is sampled at 22.05Khz, a bit depth of 8, and also in mono, calculate the audio file size in Gigabyte(M.B) if it is recorded in 5 hours.

Solution
i) 22.05 KHz, is first converted into Hz, 22.05 x 1, 000 = 22, 050
ii) Bit-depth = 8
iii) Length of time = 5 hours, i) 60sec make a minute ii) 60min makes an hour, which leads us to
5 x 60 x 60 =18, 000 seconds
iv) Number of channels = Mono (1)

Using the formula

(Sample rate x Bit-depth x Time) x No. of Channel = (22050 x 8 x 18000) x 1 = (3, 175, 200, 000) x 1 = 3, 175, 200, 000 bits

Huh, why the huge number? no worries, the cumulative size is in bits, we need to convert to bytes, then convert to K.b, and then M.b and then G.b

To convert to Bytes, we divide by 8, why? Because a byte contains 8 bits, simply right!!!
3, 175, 200, 000/8 = 396, 900, 000 bytes.

Two more step to go, we need to convert it to Mb, and then convert to Gb.
We can’t bump and divide by 1024, we rather convert to Kilobytes and convert to MB, and then convert to Gb, or we divide by multiplying 1024 x 1024 x 1024
396, 900, 000 / 1024 x 1024 x 1024 = 396, 900, 000 / 1073, 741, 824 = 0.37Gb

Calculating Bitrate

Bitrate is measured in Kilobits Per Sec (Kbps), this means how many bits a file take up for every second or just saying the number of bits that can be transmitted or received per sec.

The formula is straightforward: (Sample Rate * Bit Depth * Channel)

Examples:
1) A C.D recording is said to have a sample rate of 44.1Khz, a bit-depth of 16, calculate the bit-rate of the C.D.

Note: C.D-D.A is in stereo, using the left and right channel, so it is multiplied by 2

Solution
i) 44.1 KHz, is first converted into Hz, 44.1 * 1000 = 44, 100
ii) Bit-depth = 16
iii) Number of channels = Stereo (2)

Using the formula

(Sample Rate * Bit Depth * Channel)

44, 100 * 16 * 2 = 1, 411, 200bits/s, Bitrate is in kilobits per sec (not to be confuse with Kilobyte)

To get our answer in Kilobits, we divide by 1000, 1, 411, 200 / 1000 = 1, 411.2Kb/s

Calculating a Lossy(Compressed) Audio File Size

A lossy audio file format is usually written as an uncompressed audio file sound Interchangeably, “Lossy”, When an audio data is compressed, the compression deletes chunks of data without really been noticeable. example of a lossy audio file format is mp3, Ogg, e.t.c

The formula for calculating a lossy audio file format: (Time x Bitrate)/8

Example 1:
1.) Calculate the audio file size of Mp3 recording, if the duration is 5 minutes, and the bit-rate is 128Kbs.

Solution

When calculating a lossy audio file format, two things are important i) The Time and ii) Bitrate.

i) Length of time = 5 minutes, converting is 5 x 60 =300 seconds

ii) Bitrate is in 128 Kbps, don’t be confuse with the Kbs, This is not Kilobyte, it is kilobit, so we need to convert into Kilobyte, 8 kilobits makes a Kilobyte.

Using the formula

(Time x Bitrate)/8

(300 x 128)/8 = 38, 400 / 8 = 4, 800 Kilobytes, converting to mb 4, 800 / 1024 = 4.6875mb approximately 4.7mb

Example 2:
1.) Calculate the audio file size of Mp3 recording, if the duration is 8 minutes, and the bit-rate is 320Kbs.

Solution

When calculating a lossy audio file format, two things are important i) The Time and ii) Bitrate.

i) Length of time = 8 minutes, converting is 8 x 60 =480 seconds

ii) Bitrate is in 320Kbps, don’t be confused with the Kbs, This is not Kilobyte, it is kilobit, so we need to convert into Kilobyte, 8 kilobits makes a Kilobyte.

Using the formula

(Time x Bitrate)/8

(480 x 320)/8 = 153, 600 / 8 = 19, 200 Kilobytes, converting to mb 19, 200 / 1024 = 18.75mb

Feel free to drop your comment below, or if you wanna add to this in any way, drop your comment below and let’s discuss :)

On a Side Note

Some computer techy will argue about the standard I used, don’t be confused, I am only calculating in binary, meaning a Kilobyte is 1024 bytes if you prefer calculating in decimal, then you would want to use a 1000 bytes = 1 kilobyte, 1000 kilobytes = 1mb, 1000mb = 1Gb. For me, I am sticking with 1024, probably because I know some O.S would stick to 1024.

Visit our blog at exclusivemusicplus

Resources To Learn More

A Digital Media Primer For Geeks

Bitrate

Nyquist–Shannon sampling theorem