Computers can only store numbers, so sound has to be converted from a smooth wave into a list of binary values. These are the key ideas for GCSE Computer Science.
From analogue to digital
Sound is an analogue wave. A microphone turns it into an electrical signal, and an analogue-to-digital converter (ADC) measures the height (amplitude) of that signal at regular intervals. Each measurement is a sample, stored as a binary number.
Sample rate
The sample rate is how many samples are taken each second, measured in hertz (Hz). CD audio uses 44,100 Hz. A higher sample rate captures more detail, but every extra sample must be stored, so the file gets bigger.
Bit depth
Bit depth (also called sample resolution) is the number of bits used to store each sample. More bits means more levels: 8 bits gives 2⁸ = 256 levels and 16 bits gives 65,536. Each sample is rounded to the nearest level, so more levels means a more accurate recording.
Calculating file size
File size in bits = sample rate × bit depth × length in seconds. Multiply by 2 for stereo, then divide by 8 to get bytes.
30 s, mono, 44,100 Hz, 16-bit
44,100 × 16 × 30 = 21,168,000 bits
÷ 8 = 2,646,000 bytes ≈ 2.6 MB
Frequently asked questions
What is the difference between sample rate and bit depth?
Sample rate is how often the sound is measured. Bit depth is how precisely each measurement is stored. Raising either one improves quality and increases file size.
What happens if the sample rate is too low?
Detail is lost, and high-pitched sounds can come out at the wrong pitch. The sample rate needs to be at least double the highest frequency you want to record.
Why are MP3 files smaller?
MP3 uses compression to remove data that people are unlikely to notice, so files are much smaller than the uncompressed sizes worked out here.