What sound is: air that vibrates
A speaker cone, a guitar string or your voice box moves back and forth very fast. Each push squashes the air next to it. The squash travels outwards, like a ripple. When it reaches your ear, your eardrum wobbles too. That's hearing.
| Part of the wave | What it means | You hear it as |
|---|---|---|
| Amplitude: how tall the wave is | How hard the air is pushed | Loudness |
| Frequency: how many cycles per second | How fast it vibrates | Pitch: high or low note |
Hertz (Hz) means "times per second". A note of 440 Hz vibrates 440 times every second. 1 kHz (kilohertz) = 1,000 Hz. People hear from about 20 Hz (deep rumble) to about 20,000 Hz (a very high whistle). The top limit drops as you get older.
Analogue and digital: the ADC and the DAC
A real sound wave is analogue: smooth, with any height at any moment. A computer can only store a list of whole numbers. That is digital: separate steps. So something must convert between the two.
| Analogue | Digital | |
|---|---|---|
| Values | Smooth: any value, like 2.4371… volts | Steps: only certain values, like level 5 of 8 |
| Examples | Real sound, a vinyl record, a dimmer switch | An MP3, a CD, a file on a computer |
| Copying | Each copy adds a little noise | Copies are exactly the same numbers |
A phone call goes through this chain twice. Your phone's ADC turns your voice into numbers. The numbers travel across the network. The other phone's DAC turns them back into sound.
Sampling, step by step
The ADC can't store the whole smooth curve. So it takes samples: it measures the height of the wave at regular moments, and rounds each measurement to the nearest level it's allowed to store.
Pick regular moments in time. Here: 8 moments, evenly spaced.
At each moment, measure how high the wave is. The first one is about 3.8.
Round it to the nearest level you're allowed. 3 bits give 8 levels, 0 to 7. 3.8 rounds to 4.
Save the level as a binary number. 4 = 100.
Repeat for the whole recording. Levels 4, 6, 7, 6, 4, 2, 1, 2 → 100 110 111 110 100 010 001 010.
Size: 8 samples × 3 bits = 24 bits. Every recording is just a long list like this.
The rounding in step 3 always loses a little. The gap between the real height and the stored level is called quantisation error. You can make it smaller, but never zero. A digital recording is a very good copy, not a perfect one.
Sample rate: how often you measure
The sample rate is how many samples are taken each second. It's measured in hertz (Hz). More samples per second means the dots sit closer together, so the steps follow the real curve more closely.
| Sample rate | Samples every second | Used for |
|---|---|---|
| 8 kHz | 8,000 | Phone calls |
| 22.05 kHz | 22,050 | Old games, voice notes |
| 44.1 kHz | 44,100 | CDs, most music |
| 48 kHz | 48,000 | Film, TV and video |
| 96 kHz | 96,000 | Recording studios |
Two different things are measured in hertz. The pitch of a sound (how fast the air vibrates) and the sample rate (how often the ADC measures). A 44,100 Hz sample rate does not mean a 44,100 Hz note.
Bit depth: how precisely you measure
The bit depth is how many bits store each sample. Same rule as colour depth: n bits give 2ⁿ levels. More levels means smaller gaps, so each sample is rounded less.
| Bit depth | Levels (2ⁿ) | Sounds like |
|---|---|---|
| 3 bits | 8 | Very rough, crackly |
| 8 bits | 256 | Phone calls, old game music |
| 16 bits | 65,536 | CD quality |
| 24 bits | 16,777,216 | Studio recording |
Explorer: original vs what's stored
One second of a made-up sound. It has a slow wobble (2 Hz) and a faster wiggle (5 Hz). Change the settings. The red shading is the error: everything the recording got wrong.
Why does low bit depth sound "hissy" or "crunchy"? Every sample is rounded. The rounding errors jump about at random, and random wobbles sound like hiss. Each extra bit halves the size of the gaps, so it halves the error.
The Nyquist rule: how fast is fast enough?
To capture a vibration, you must catch it going up and coming down. That needs at least two samples per vibration. Sample any slower and something strange happens: a high note turns into a wrong, lower one.
By hand: why do CDs use 44,100 Hz?
The highest pitch people hear is about f = 20,000 Hz.
Nyquist: sample at least twice as fast. r ≥ 2 × 20,000 = 40,000 Hz.
Before sampling, a filter must remove sounds above 20,000 Hz, or they'd alias into wrong notes. Real filters can't cut off sharply, so they need a little room.
44,100 is 40,000 plus about 10% spare for that filter.
The exact number 44,100 also fitted the video-tape recorders used to master the first CDs in 1980. History, not physics.
By hand: phone calls
Phone networks sample at 8,000 Hz.
Turn Nyquist round: the highest pitch it can capture is half the sample rate. 8,000 ÷ 2 = 4,000 Hz.
Speech is understandable up to about 3,400 Hz, so voices work. But music on hold sounds dull: everything above 4,000 Hz is cut.
The Nyquist rule is beyond the AQA 8525 and OCR J277 GCSE specs. They expect: "a higher sample rate gives a closer match to the original sound, and a bigger file". It's here because it answers the question every class asks: why 44.1?
Calculating a sound file's size
Every second has r samples. Every sample has d bits. Stereo has two channels, so double it. Multiply by the number of seconds. That's the size in bits.
By hand: 3 minutes of CD audio
Gather the numbers. r = 44,100 Hz, d = 16 bits, c = 2 (stereo). t = 3 minutes = 3 × 60 = 180 seconds. Always turn minutes into seconds first.
Bits per second, one channel: 44,100 × 16 = 705,600.
Both channels: 705,600 × 2 = 1,411,200 bits every second. (Music fans call this "1,411 kbps".)
Whole song: 1,411,200 × 180 = 254,016,000 bits.
Bytes: ÷ 8 = 31,752,000 bytes.
MB: ÷ 1,000,000 = about 31.8 MB. An MP3 of the same song is 3–4 MB because it's compressed (Topic 7).
Sound file size calculator
bits = sample rate × bit depth × seconds × channels. Then ÷ 8 for bytes, ÷ 1000 for KB, ÷ 1000 for MB. OCR J277 writes it without channels (it assumes mono). AQA 8525 writes "rate × resolution × seconds". Add × 2 only when the question says stereo.
Mono, stereo, and the quality–size trade-off
Mono = one channel: one list of samples, played from every speaker. Stereo = two channels, left and right, recorded by two microphones. Each channel is a whole list of its own, so stereo is twice the size.
| You change… | Quality | File size |
|---|---|---|
| Double the sample rate | Captures higher pitches, closer to the curve | × 2 |
| Double the bit depth (e.g. 8 → 16) | Far more levels, much less hiss | × 2 |
| Mono → stereo | Sound has left and right | × 2 |
| Double the length | Same quality | × 2 |
| Halve any one of them | Worse (or shorter) | ÷ 2 |
Listen: hear sample rate and bit depth
Turn your volume down first. A short tune of 4 notes, then a high whistle at 3,000 Hz. Pick the settings, then press Play.
An ADC you can build: Arduino and micro:bit
An Arduino has its own ADC built in. analogRead(A0) measures the voltage on pin A0 (0 to 5 volts) and gives back a whole number from 0 to 1023. That's a 10-bit ADC: 2¹⁰ = 1024 levels. It's exactly the bit-depth idea, in a chip.
By hand: the reading is 512. How many volts?
One step is 5 ÷ 1024 volts. Keep it as a fraction for now: V = 512 × 5 ÷ 1024.
Multiply first: 512 × 5 = 2,560.
Then divide: 2,560 ÷ 1024 = 2.5 V. Half the reading range → half of 5 V. ✓
LED brightness: analogWrite takes 0 to 255. 512 ÷ 4 = 128, about half brightness.
The micro:bit has a 10-bit ADC too: pin0.read_analog() gives 0 to 1023. Its pins run on 3.3 V, so one step is 3.3 ÷ 1024 V. The v2 also has a built-in microphone. microphone.sound_level() takes one sample of loudness, from 0 to 255 (8 bits).
from microbit import * # take 20 samples a second and send them to the plotter while True: level = microphone.sound_level() # 0 to 255: one 8-bit sample print((level,)) # a tuple, so the editor can plot it sleep(50) # 50 ms gap = 20 samples per second
Why only 20 a second? This measures how loud the room is, not the wave itself. Change sleep(50) to sleep(500) and claps start to go missing between samples. That's a low sample rate, made visible.
Common mix-ups
The mistakes nearly everyone makes the first time. Read the left side, then the right.
Bit depth means bits per second.
Bit depth is bits per sample. Bits per second = sample rate × bit depth (the "bit rate").
A 44,100 Hz recording plays a 44,100 Hz note.
Sample rate is how often the ADC measures. Pitch is how fast the air vibrates. Both use Hz.
16-bit sound has 16 levels.
2¹⁶ = 65,536 levels. 4 bits would give 16.
A higher sample rate makes it louder.
Loudness is the wave's amplitude. Sample rate changes how accurately it's captured.
Stereo is better quality, so it's the same size.
Stereo is two full lists of samples: twice the size.
The size formula gives bytes. Or: put the length in minutes.
It gives bits, and the length must be in seconds.
Digital audio is a perfect copy of the sound.
Every sample is rounded (quantisation error) and anything between samples is lost. It's very close, never perfect.
Check yourself
Quick questions first. Then endless practice: a wrong answer shows you the working, step by step.