# Lesson video

In progress...

Hi, I'm Rebecca, your computing teacher for the data representations unit.

For this lesson, you're going to need a pen and paper to do any calculations or make any notes that you need to.

You're also going to need to remove as many distractions as you possibly can out the way so that you can really focus in this lesson.

Once you've done all of that, we can begin.

In this lesson, you will explain why analogue sound data needs to be converted to binary digits.

You'll describe the concept of sampling, sample rate, and sample resolution.

And you'll calculate file size requirements for sound files.

You may have seen sound represented in waves like this image.

Sound is a pressure wave that causes the air to vibrate.

This fact is used in microphones and speakers.

A computer cannot interpret an analogue sound wave like this one.

It must be digitised and turned into binary values.

Speakers allow devices to generate sound from these binary values.

A vibrating cone causes pressure waves in the air, which you hear a sound.

Let's take a look at a Scratch project that has been designed to demonstrate sound waves.

It shows how a sound wave is linked to changes in air pressure.

This is an animation that shows you the nature of sound and how that links to variations in air pressure.

So you can see as I talk and as I make louder noises and those different movements, you can see the air pressure changing at the bottom line there, the microscopic view particles of air, and you can also see the wave that's generated from that.

So if I stop talking, it stops.

It's just very gentle 'cause it's just picking up the home of my computer probably.

As soon as I start talking again, it starts going.

So that is how sound works in our world.

The amplitude or height of the sound wave represents the volume.

The higher the amplitude, the higher the volume of the sound.

The frequency of the wave refers to how many waves occur within a specified period of time.

A high frequency wave will show waves that are close together, and a low frequency wave will show waves that are further apart.

A higher frequency produces a higher sound that can be heard by the human ear.

We call this the pitch of the sound.

A high pitch produces a high sound like laaa! A low pitch produces a low sound like looo! Like that.

The height of the wave is called the what? It's the amplitude.

If the waves are close together, it will produce a what sound? Fill in the blank.

High.

So the sound we hear is analogue, but computers must store it digitally.

How might you convert this wave to numeric values? So you've got an example there.

You can take readings at specific times and intervals and record them.

And these are called samples.

In order to digitise this sound, we take samples.

The amplitude values are shown on this graph in binary.

The type and range of numbers we can use is limited 'cause we've only got a certain amount of bits that we can use.

You're about to complete an activity where you will note down the amplitude of the wave at specified intervals.

This is known as sampling.

So take a look at your worksheet and have a go at sampling the wave.

Fantastic.

So these are the solutions.

So you should have got something like this or fairly close to these values here.

If not, you pause the video and just correct them now.

And then if we plot the sample data over the original data, then we can notice differences in the sound waves.

If you take a look there, the black line is the original data, so that's showed you there, but then also you've got the red line, which is the new data.

And you can see there that there's differences because for starters, we didn't record the value for zero for no time 'cause at the bottom there is time, like one second, two second, three seconds.

We didn't record a value for zero seconds, so it's just put it at zero, nothing.

And then also, because we had only certain places that we can enter those readings, those samples, it has gone slightly off.

So we've missed certain bits of data out.

So this recording wouldn't be exactly as we expect it.

We can increase the accuracy of the sound recording by increasing the rate at which we take sample.

This is called the sample rate.

The sample rate is the number of samples taken per second.

And this is measured in Hertz.

So you can see there that this time there are more samples because we're doing it every half a second.

So this time it's a little bit more accurate.

There isn't really much missed out there of that sound because we've managed to sample more of that wave.

We used four bits to represent each sample.

This is called the sample resolution or sample size.

The number of samples per second is known as the sample what? The sample rate.

The number of bits use per sample is known as the what? The resolution.

We used four bits to represent each sample.

This is called the sample resolution or sample size.

Another way to increase the quality of the sound recording is to increase the sample resolution or use more bits.

So if you look at the diagram there, you can see more bits were used and we've got a more accurate recording for that.

The sample resolution is usually around 16 bits.

This means that there are 65,536 combinations of those bit patterns to record those sounds, different values available to record the amplitude of the sound.

You might have heard of MP3 or WAV files.

And these are common file types for sound.

So we're going to have a keyword recap here because we've done quite a lot of keywords so far that might be new to you.

So see if he can remember what those keywords mean and write a bit of a description down for them.

Pause the video while you do that.

Here's the answers then.

So amplitude, the height of the wave, representing the volume.

Frequency was the number of waves in a particular time period.

Pitch, a high pitch creates a high sound and a low pitch creates a low sound.

Sample resolution, the number of times the wave has been sampled per second.

Sorry, that was sample rate.

The number of times the wave has been sampled per second.

And then sample resolution, the number of bits used to record each sample.

And then finally, you've got Hertz, the measurement of the sample rate.

So calculating the size of a sound file.

Let's see how we do that.

The formula for calculating the file size is sample rate times sample resolution times duration.

So remember that sample rate is the samples per second measured in Hertz.

Sample resolution is the number of bits used per sample.

And the duration is measured in seconds with this formula here.

Calculate the file size in bits for a 30 second sound recording that has used a sample rate of 1,000 Hertz and a sample resolution of four bits.

So this is a typical question that you might get.

So you've got to pick out which bits do you need to use in your formula.

And it's going to be these bits.

So we're going to work out.

The answer needs to be in bits, so we don't have to convert it to bytes or kilobytes or anything like that.

It's just in bits.

It's a 30 second sound recording.

It's 1,000 Hertz and it's four bits.

So we do 1,000 times 4 times 30.

So see if you can work out the answer to that.

So it was 120,000 bits.

That's quite a lot of bits for a 30 second clip.

So this time, I want you to try and do without me giving you the formula.

See if you can figure it out.

So pause the video while you do that.

Here we go then.

So you'd have to do this time.

Got a little trick there because like I gave you two minutes there, instead of saying 120 seconds.

It has an extra little calculation to do there.

So you did do 1,000 Hertz, did do five bits, but in that bracket you had to do 2 times 60 first.

So 2 times 60 is 120.

So your actual calculation was 1,000 times 5 times 120.

And the answer was 600,000 bits.

That is a lot of bits.

So let's take a look at this one then.

It says, "Calculate the file size in bits "for a two minutes sound recording "that has used a sample rate of 2,000 Hertz "and a sample resolution of four bits." Pause the video while you have a go at that one.

Let's take a look at the answer there.

So picking out that key bits of information there.

So it's two minutes, it's 2,000 Hertz and it's four bits.

So we know it needs to be in seconds, so we've got to do 2 times 60.

We do that first to get 120.

And then our calculation is 2,000 times 4 times 120, and the answer is 960,000 bits.

Now there are some more to help you practise in the final quiz as well.

So you can have a little bit more practise at doing your sound file calculations there.

And if you'd like to, you can please ask your parent or carer to share your work on Instagram, Facebook, or Twitter tagging @OakNational and #LearnwithOak.

And you can share what you have learned today with us.

I'll see you again soon for the next lesson.