- [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 analog wave,
and to store the sound in binary, we need to convert what is an analog signal into a digital binary one.
This process is called analog-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're sampling the original analog 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,100 hertz.
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 analog 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 analog 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 analog 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 six hertz or six samples a second,
and a bit depth of four.
That's four bits per sample, giving a bandwidth of nought to 15.
Now, the numbers are shown in denary convenience,
but of course, these would be stored as binary values
zero zero zero zero to one one one one.
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 six samples per second.
Multiplied by four bits per sample, multiplied by three seconds of sample
for a total of 72 bits,
or when divided by eight, nine bytes.
So a solid grasp of understanding how sound is represented
lies in you understanding the different terms, and they all have slightly different meanings.
So let's have a look.
We've got a sound file size.
That's the total number of bits in a sound file.
And we calculate that as the number of samples we have to take per second
timesed by the number of bits we need per sample, timesed by the length of the sample in seconds.
We then have the bit depth, which is the number of bits stored per sample.
The higher number of bits, the greater the quality of the sound but the larger the file size.
We have the sample interval.
That's the amount of time which passes between capturing each sample.
This is opposed to the sample rate, which is the number of samples that we record and store per second.
Again, the higher number of samples per second,
the higher the quality of the finished sound but the larger the file size.
And finally, there's amplitude.
So with sound waves, this is the extent to which air particles are displaced.
This sound amplitude is experienced as the loudness of the sound.
(uplifting piano jingle)