A computer can't store a sound wave itself. It measures the wave's height many times a second (sampling) and rounds each measurement to a level, so a recording is a long list of numbers. More samples and more levels sound closer to the real thing, but need more numbers.
A song is a wobbling wave of air. How does a computer turn that into numbers, and why are music files so big?
Sound is a wave: air pushed back and forth. A microphone turns it into a changing signal, but a computer can only store numbers. So it samples the wave: it measures how high the wave is at regular times, rounds each measurement to one of a set of levels, and stores those numbers. To play the sound back, it turns the numbers back into a signal.
Predict: Read the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Try: Try it on the board and compare the result with your prediction.
Investigate: Work out why it happens, one step at a time.
Modify: Change the problem on purpose and see what happens.
Practise: A few on your own, to check you have it.
Make: Make your own problem using what you have learned. Expect a few tries; that is normal.
Make your prediction first. Help opens once you've locked it in.
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Twice as many samples
TryTry it on the board and compare the result with your prediction.
Try: take more samples
Was your prediction right? Press ▶ to hear the original and the copy made from the numbers.
Try it yourselfYour edits are saved in this browser.
Move Samples a wave from 8 up to 16. How many numbers are stored now?
Use the board. This ticks when you get there.
InvestigateWork out why it happens, one step at a time.
Worked example: from wave to numbers
Worked exampleBefore each step, say what you think comes next.
sound→waveThe microphone turns air movement into a signal that goes up and down.
measure every 81 waveSampling: measure the height at regular times.
round to a levelEach height is rounded to the nearest level (here 16 levels, 0 to 15).
8,13,15,13,8,2,0,2The numbers stored for one wave.
numbers→stepsPlaying back joins the levels into steps, close to the wave but not exact.
Real music takes 44 100 samples every second, with 65 536 levels. Now count the numbers for 3 waves.
A recording takes 8 samples each wave, for 3 waves. How many numbers does it store?
Sam explains how sound is recorded. Click the line where the explanation first goes wrong.
ModifyChange the problem on purpose and see what happens.
Vary: one setting at a time
Try it yourselfYour edits are saved in this browser.
Turn Levels down to 4. What happens to the steps? Play it.
Use the board. This ticks when you get there.
Put Levels back to 256, then push Samples a wave to 32.
Use the board. This ticks when you get there.
Now drop Samples a wave to 4. How close is the copy?
Use the board. This ticks when you get there.
Drop Samples a wave to 2. What do the numbers say? Play it.
Use the board. This ticks when you get there.
PractiseA few on your own, to check you have it.
Samples and sizes
Music is sampled 44 100 times a second. How many samples are in a 10 second clip?
Review: an image is 2 pixels by 2 pixels, three numbers a pixel. How many numbers?
MakeMake your own problem using what you have learned. Expect a few tries; that is normal.
Just good enough
Then: why might a phone call use far fewer samples a second than music?
Try it yourselfYour edits are saved in this browser.
Need a hint?
Set Levels to 256 first, so rounding barely matters.
Another hint
Raise Samples a wave one at a time and watch how far off the wave the copy is.
Another hint
Stop at the first value below 10%.
With 256 levels, find the fewest samples a wave that keep the copy less than 10% off the wave.
Use the board. This ticks when you get there.
For teachers
Students sample a sound wave on a board, changing the samples a wave and the levels, to see that audio is stored as a list of measured, rounded amplitudes, and that more samples and levels sound closer but need more numbers (AC9TDI8K03 node 4). About 40 minutes.
I can say what changing the samples or the levels does.
I can work out how many samples a recording stores.
Before class
Try the boards yourself, with sound on: the play buttons use the browser's audio (headphones help in class).
The one idea: sound is stored as samples, measurements of the wave's height at regular times, each rounded to a level. More samples and more levels are closer to the real sound and need more data.
Simplifications to say out loud: the board shows a few samples a wave of one pure tone; real recordings take 44 100 or 48 000 samples a second with 65 536 levels (16 bits), and playback smooths the steps. The "% off the wave" counts the step shape too, so it never reaches 0 here. Two samples a wave landing on the crossings is a simplified hint at the sampling theorem.
Running the lesson
Predict: students who chose "the wave is stored" hold Sam's misconception; come back to them after the Try.
Try: play the original and the copy at 8 and 16 samples.
Worked example: ask what level a sample at the very top of the wave gets.
Vary: the 2-samples task usually surprises; ask why the copy is silent.
Make: compare answers at 16 levels too (10 samples is then just over 10%).
The hard part (on purpose)
Students think the recording is the wave itself. Keep pointing at the dots: those are the only numbers the computer has; the steps are rebuilt from them.
When students get stuck
A student says the computer stores the wave (Sam's mistake). Ask: What are the dots on the board? Fix: They are the only numbers stored; everything else is rebuilt.
A student thinks more levels means more numbers. Ask: How many dots are there when you change the levels? Fix: Same dots, finer rounding: levels change each number, not how many.
Stretch and support
Stretch: Phone calls use about 8 000 samples a second; music uses 44 100. Why is a phone call still understandable?
Support: Keep the counting rule on the board: numbers = samples a wave × waves (or samples a second × seconds).
Where it leads
Next: Bits and binary numbers, then How many patterns? (why one byte holds 0 to 255 and why 16-bit audio has 65 536 levels).
Code links: micro:bit and Arcade play tones from numbers; the micro:bit's microphone gives a sound level 0 to 255.
What each step is for
twice as many samples: Committing to what doubling the samples does to the stored data tests the new move: a recording is a list of measurements, so more measurements means more numbers.
Try: take more samples: Moving the samples from 8 to 16 a wave settles the prediction: the count of numbers doubles and the steps hug the wave more closely.
Worked example: from wave to numbers: Following one wave through sampling, rounding and storing models the new move. Sam thinks the wave's shape is stored exactly, the misconception planted after the method.
Vary: one setting at a time: Each task changes one setting: fewer levels, many more samples, very few samples, then the edge case where two samples a wave land on the middle and store silence.
samples and sizes: Counting samples for real sample rates, halving the rate, why music files are big, and a review of counting numbers in an image.
just good enough: Finding the fewest samples that keep the copy within 10% reverses the process: students start from a quality target and choose the settings.