ScholaFly

CS03-03 Computer Science Watch

How sound is stored

Watch on YouTube

In this lesson

In this video you'll learn about how sound is stored for GCSE Computer Science.

By the end: Explain that sound is analogue and must be sampled to be stored digitally, define a sample, the sampling rate, the sample resolution or bit depth and the sample interval, and describe how the sampling rate and the number of bits per sample affect playback quality and file size - using the name your own board uses.

What it covers

  1. 1:17 Sound is analogue

Key words

About this video

How sound is stored: sampling rate and bit depth explained

How sound becomes digital samples, and how the sampling rate and bit depth (sample resolution) change quality and file size.
AQA 8525, Edexcel 1CP2 and OCR J277 GCSE. Images and sound 3 of 7.
Full Images and sound playlist: https://www.youtube.com/playlist?list=PLAonf4a5MXts
More at https://scholafly.com

Watch first: Denary (Decimal) to Binary and Back - https://youtu.be/8BNbDYvaatg
Video code: CS03-03 (search "ScholaFly CS03-03")

Videos in this chapter:
CS03-00 Images, sound and compression - Intro: https://youtu.be/5_VNvpWBbVU
CS03-01 How an image is stored: https://youtu.be/HKb8YHkv23c
CS03-02 From binary to bitmap and back: https://youtu.be/D7AjvZoKT_M
CS03-03 How sound is stored: https://youtu.be/LOCcQaN-_fI
CS03-04 Working out image and sound file sizes: https://youtu.be/_CcijC_0L1U
CS03-05 Why we compress data: https://youtu.be/ylXSh7OO4dI
CS03-06 Huffman coding: https://youtu.be/ig0uHFLoc9U
CS03-07 Run length encoding

#GCSEComputerScience #ImagesAndSound #HowSoundIsStored

For teachers
This GCSE Computer Science lesson teaches how sound is stored. By the end, students should be able to explain that sound is analogue and must be sampled to be stored digitally, define a sample, the sampling rate, the sample resolution or bit depth and the sample interval, and describe how the sampling rate and the number of bits per sample affect playback quality and file size - using the name your own board uses. It works through four worked examples and the mistakes examiners report, and suits Foundation and Higher tier students.

Exam board specification references:
AQA GCSE Computer Science (8525)
- 3.3.7 Representing sound
Pearson Edexcel Level 1/Level 2 GCSE (9-1) in Computer Science
- 2.2.3 Explain how analogue sound is represented in binary in terms of amplitude, sample rate, bit depth and sample interval.
Cambridge OCR Level 1/Level 2 GCSE (9-1) in Computer Science
- 1.2.4 Data storage - Numbers

Read the transcript

A microphone hears a smooth curve. A computer can only write down numbers. So the machine measures the curve's height, thousands of times a second, and stores those heights. The recording you play back is not the sound that happened; it is a very fast join-the-dots of it. Picture one recording made with forty-four thousand one hundred measurements a second, each written with sixteen bits. Halve that sixteen, and both the sound and the file change. By the end of this video you can say how. It comes down to two decisions made before anyone presses record: how often to measure, and how carefully to write each measurement down. We start with why sound needs measuring at all.

Video three of seven in Images, sound and compression is the first one about sound. It leans on binary, so if that is rusty, Denary to binary and back is the one to revisit.

Sound is analogue. It changes smoothly, with no gaps and no steps between one moment and the next. A computer stores digital data, which is a fixed set of separate values. So sound has to be converted before it can be stored, and the conversion is called sampling. A sample is one measurement of the wave's amplitude at a point in time. Amplitude is the wave's height above or below its centre line. Picture a vertical stick dropped from the wave to the centre line at regular moments. Each stick's height is one sample, and the computer stores those heights as binary numbers. A student writes that each sample records the frequency of the wave, meaning how often the wave rises and falls. What is wrong with saying a sample records the frequency? Frequency describes the sound itself over time, which is about pitch. A sample is a single height at a single instant, so it holds amplitude, not frequency. One examiner's report records students saying the frequency is what gets measured. It explains: the frequency is a technical sound term that relates to the pitch of the wave, or the number of times the wave changes. The fix is to say amplitude, or height, at a point in time, every time you define a sample. Frequency is a word about the sound, never about the measurement.

The first decision is how often to measure. The sampling rate is how many samples are taken in each second. It is measured in hertz. One hertz is one sample per second, so a rate of forty-four thousand one hundred hertz means forty-four thousand one hundred samples every second. Raise the rate and the sticks crowd closer together along the wave. The join-the-dots follows the curve more closely, so playback sounds more like the original, and there are more samples to store, so the file is bigger. Two students define the sampling rate. One writes, the number of samples. The other writes, the amount of sound recorded. Both of those definitions miss the same thing. What is it? Any mention of time. Per second is half of the definition, and without it the sentence describes a total, not a rate. One examiner's report names the gap in the same terms. However, too many students referred to amount of sound or number of samples but with no reference to a time period. The habit: say hertz and per second together, because one hertz is one sample per second, and the unit carries the missing half. Keep the unit and the quantity apart too. Hertz is the unit; the sampling rate is the quantity measured in hertz. Asked to define hertz, say one of something per second. The same sticks can be measured another way. The sample interval is the time between one sample and the next, and one course uses that term by name. A sound is sampled one thousand times a second. Give the rate with its unit, and the interval. The rate is one thousand hertz. The interval is one thousandth of a second, which is nought point nought nought one seconds, because a thousand equal gaps fill each second. One examiner's report sets the two side by side. Many candidates confused the frequency of sampling, number of samples taken per second, with the actual sampling interval which is the time between each separate sample. The fix: count the sticks in one second for the rate, and measure the gap between two sticks for the interval. As one goes up, the other comes down.

The second decision is how carefully each measurement is written down. That is the number of bits used to store each sample. This number has two names. One course calls it the sample resolution, and the other two call it the bit depth. Both mean bits per sample, so learn the name your own course prints and use it every time. Here is why the bits matter. Each stored height has to land on one of a fixed set of values, like the rungs of a ladder standing beside the wave. Three bits give eight rungs, so every height is rounded to the nearest of eight values. Sixteen bits give sixty-five thousand five hundred and thirty-six rungs, so the stored height sits much closer to the real one. So more bits per sample means each measurement is more accurate, playback is closer to the original, and the file is bigger. It does not add a single sample. A student is asked to define the sample resolution and writes: it makes the sound better quality. Why is that sentence not a definition of sample resolution? It gives an effect, not a meaning. The definition is the number of bits used to store each sample; what that does to the sound belongs in a separate sentence. One examiner's report describes this answer. This question was less successfully answered, with few students able to write the correct definition of sample resolution. Many students referred to the quality of sound, which it will affect, but is not the definition. Too many students referred to images in their answer. The habit is to give what it is first, with the word bits in it, and what it does second. And keep pictures out of a sound answer. Back to the recording from the start: forty-four thousand one hundred hertz, with a bit depth of sixteen. Now halve the second number to eight. With the bit depth halved, what happens to the sound, and to the file? The sound gets rougher. Each sample now has far fewer possible values, so every height is rounded more coarsely. Eight bits give two hundred and fifty-six values, where sixteen gave sixty-five thousand five hundred and thirty-six. And the file shrinks, because every sample takes half the bits, while the number of samples each second stays the same.

That gives two separate settings. The sampling rate decides how many sticks there are. The bits per sample decide how many rungs each stick can land on. Turn either one with the other frozen and you can hear the difference, but they never change each other. More rungs never adds a stick, and more sticks never add a rung. Three statements about the two settings. The first says raising the sampling rate makes the file bigger. The second says raising the bit depth means more samples are taken each second. The third says lowering either one makes playback less like the original. Which of those three statements is wrong, and what should it say? The middle statement is wrong. Raising the bit depth stores each sample with more bits, so each can be one of more values. How many samples are taken each second is the sampling rate's job alone. One examiner's report records the swap. Some candidates incorrectly identified that the bit depth would result in more samples being taken per second. The fix is to give each setting its own job, every time: the rate is how many sticks, and the bits per sample are how many rungs. This is the same mix-up as swapping the two numbers of an image, wearing a different hat. Images have two numbers and so does sound, but the sound ones have their own words. And one report records answers drifting to pictures. This question was about digital sound samples and many students were able to give a good definition. However, there was a substantial number who confused sound with images and gave a response relating to images. The habit: in a sound answer, use only sound words. Sampling rate, bits per sample, amplitude and samples per second are the words a sound question wants. One course also names the duration, meaning how many seconds of sound the file holds. It matters once a file size is calculated, which is the job of Working out image and sound file sizes.

A short run of questions now, with the last one back at the join-the-dots. In one sentence, what does a single sample store? One measurement of the wave's amplitude, its height, at a single point in time. Next, a new rate. Eight thousand samples a second: what is that, with its unit? Eight thousand hertz. Hertz already means per second, so the unit carries the time. Now bit depth. From eight bits to twelve: more samples, or more values per sample? More values per sample. The number of samples each second does not move. Here's the last one, back to the join-the-dots. Which two settings decide how close it gets? How often you measure, which is the sampling rate, and how carefully you write each measurement down, which is the bits per sample.

A fair test: if you could define a sample, the sampling rate and the bits per sample from memory, in your own course's words, you're solid on this, so press the thumb. If those definitions still blur together, save it for now, because nobody gets this first time.

Next in the chapter: Working out image and sound file sizes.

For more, visit scholafly.com, or watch the next video.

Related terms

For: AQA GCSE 8525, Edexcel GCSE 1CP2, OCR GCSE J277

On the specification

BoardSpecStatement
AQA GCSE 85253.3.7Representing sound
Edexcel GCSE 1CP22.2.3Explain how analogue sound is represented in binary in terms of amplitude, sample rate, bit depth and sample interval.
OCR GCSE J2771.2.4Data storage - Numbers
For teachers

This GCSE Computer Science lesson teaches how sound is stored. By the end, students should be able to explain that sound is analogue and must be sampled to be stored digitally, define a sample, the sampling rate, the sample resolution or bit depth and the sample interval, and describe how the sampling rate and the number of bits per sample affect playback quality and file size - using the name your own board uses. It works through four worked examples and the mistakes examiners report, and suits Foundation and Higher tier students.