- [Craig] In this video, we explore how sound is represented in computer systems.
(uplifting piano jingle)
Sound is a vibration that propagates as an audible wave of pressure through the air.
In human physiology, sound is the reception of these waves and their perception by the brain.
The sound waves are generated by a sound source
such as the vibrating diaphragm of a speaker and detected by a microphone or the human ear.
We can visualise sound as an analogue wave,
and to store the sound in binary, we need to convert what is an analogue signal into a digital binary one.
This process is called analogue-to-digital conversion.
Before we look at how sound files are represented in detail,
let's first consider what affects the overall quality of a digitally converted sound wave.
The primary factors are the sample rate, that is how often per second we are sampling the original analogue sound,
and the bit depth - this is the amount of detail we're capturing with each sample.
So, both the sample rate and the bit depth affect both the quality of the sound stored and the file size.
Let's take a look at these factors now in a little more detail.
The whole sound is known as a sound sample
and it's converted to binary by taking a measurement of the wave at regular intervals.
Those regular intervals, represented by the grey vertical lines, happen many times a second and are known as the sample rate
which we measure in hertz.
For example, a music CD is sampled at 44,100Hz - that's 44,100 times a second.
The greater the number of samples per second, the higher the quality the sound will be
but also the larger the file size, as we're storing more data per second.
At each sample, the analogue wave is stored in binary to the closest value possible depending on the bit depth.
The number of bits used for each sample is known as the fidelity, the sample resolution,
or in the case of your exams, the bit depth.
And the total range of numbers is referred to as the bandwidth.
The greater the number of bits in each sample, the closer the sample will be to the original analogue sound
and therefore, this also increases both the quality and the file size.
The orange line shows the digital version we are able to store from the analogue wave given the sample rate and the bit depth.
Typically, CD quality has a bit depth of 16 bits per sample.
In this simple example, we're showing a sample rate of 6Hz, or 6 samples a second,
and a bit depth of 4 - that's 4 bits per sample, giving a bandwidth of 0 to 15.
Now, the numbers are shown in denary convenience, but of course, these would stored as binary values, 0-0-0-0 to 1-1-1-1.
The total size of the sound file is calculated by multiplying the sample rate by the duration in seconds by the bit depth.
In this example, that gives us 6 samples per second multiplied by 4 bits per sample, multiplied by 3 seconds of sample,
for a total of 72 bits,
or when divided by 8, 9 bytes.
So, just to recap then, sound file size is the total number of bits in a sound,
and we calculate it as the number of samples per second timesed by the number of bits per sample,
timesed by the length of a sample in seconds.
Bit depth is the number of bits stored per sample, and the higher the number of bits,
the greater the quality of the sound and the larger the file size.
And sample rate is the number of samples stored per second, and again, the higher the number of samples per second,
the higher the quality of the sound and the larger the file size.
(uplifting piano jingle)