Secondary Computer Science / 1.2 Media Encoded as Data

1.2.3 Sampling Sound Waves

🔒 Lesson slides are available to signed-in users. Sign in

1.2.3 Sampling Sound Waves

A student podcast club records a short welcome message for the school website. The original voice is a changing sound wave. Before a computer can store or process the recording, the wave must be converted into binary data.

This is done by taking measurements of the sound wave at regular intervals. These measurements are called samples. Each sample is then represented using a binary value.

By the end of this section, you should be able to:

  • explain why sound must be converted into binary data;
  • describe sampling as measuring a sound wave at regular intervals;
  • define sample rate and sample resolution;
  • explain how sample rate affects recording accuracy and file size;
  • explain how sample resolution affects recording accuracy and file size;
  • apply these ideas to simple recording scenarios.

From sound wave to digital data

Real sound changes continuously. A microphone detects these changes and converts them into an electrical signal. The computer then needs a digital representation made from stored numbers.

Sound wave 声波: a pattern of changing air pressure that can be heard as sound.

Analogue 模拟: data that can vary continuously.

Digital 数字: data represented using discrete values, usually stored as binary.
Stage What happens Result
1. Original sound A voice or instrument produces a changing sound wave Continuous analogue sound
2. Sampling The wave is measured at regular time intervals A sequence of sample values
3. Binary representation Each sample value is stored using bits Digital sound data
4. Playback The stored values are used to reconstruct an approximation Sound is produced again

Common mistake

A recorded sound file does not store the original air vibration itself. It stores numeric measurements that can be used to approximate the sound when played back.

Sampling a sound wave

Sampling means taking measurements of the wave at regular intervals. Each measurement records the amplitude of the sound wave at that moment.

Sample 样本: one measurement taken from a sound wave.

Amplitude 振幅: the height of the wave at a particular moment, related to the loudness of the sound.

Sampling 采样: taking repeated measurements from a wave so that it can be represented digitally.

If only a few samples are taken, the computer has limited information about the shape of the original wave. If more samples are taken, the recorded data can follow the shape more closely.

Answer-building tip

A strong answer explains both actions: the sound wave is measured repeatedly, and each measurement is stored as a binary value.

Sample rate

The sample rate tells us how many samples are taken every second.

Sample rate 采样率: the number of samples taken from a sound wave each second.

Hertz 赫兹 (Hz): a unit meaning “per second”. For example, 8000 Hz means 8000 samples per second.
Sample rate Meaning Samples in 5 seconds
4000 Hz 4000 samples per second 20 000 samples
8000 Hz 8000 samples per second 40 000 samples
16 000 Hz 16 000 samples per second 80 000 samples

Increasing the sample rate usually improves the accuracy of the recording because the wave is measured more often. However, it also creates more sample values to store.

Common mistake

Sample rate is about how often measurements are taken, not how many bits are used for each measurement.

Sample resolution

After a sample has been taken, its amplitude must be stored as a binary value. Sample resolution tells us how many bits are available for each sample.

Sample resolution 采样分辨率: the number of bits used to represent each sound sample.

Bit depth 位深度: another common term for the number of bits used to store one sample.
Sample resolution Calculation Possible amplitude levels
2 bits per sample 22 4 levels
3 bits per sample 23 8 levels
4 bits per sample 24 16 levels
8 bits per sample 28 256 levels

A higher sample resolution gives more possible values for each measurement. This can represent changes in amplitude more accurately, but each sample uses more bits.

Common mistake

Doubling the sample resolution does not merely double the number of amplitude levels. The number of possible levels is calculated using powers of two.

Worked example: a short sound clip

A one-channel sound clip is recorded for 6 seconds. It uses a sample rate of 12 000 Hz and a sample resolution of 8 bits per sample.

Step 1: calculate the number of samples

12 000 samples per second × 6 seconds = 72 000 samples

Step 2: calculate the sample data

72 000 samples × 8 bits = 576 000 bits

This is a simplified calculation for sample data only. A real sound file may also include additional information such as file format, sample rate, sample resolution and channel information.

Answer-building tip

Use the correct factor for the question: sample rate affects the number of samples, while sample resolution affects the number of bits per sample.

Accuracy and file size

Sample rate and sample resolution both affect the quality and amount of stored data.

Change Effect on recording accuracy Effect on file size
Increase sample rate The wave is measured more often, so the shape can be followed more closely More samples are stored
Decrease sample rate Fast changes in the wave may be missed Fewer samples are stored
Increase sample resolution Each sample can use more amplitude levels More bits are stored for each sample
Decrease sample resolution Amplitude values are rounded into fewer levels Fewer bits are stored for each sample

Develop the explanation

Avoid writing only “quality improves”. Explain why: a higher sample rate takes more measurements per second, so the recorded data can follow the wave more closely.

When sample values are rounded

A sample may not match exactly one of the available amplitude levels. The value must then be rounded to the nearest level that the chosen sample resolution can represent.

Quantisation 量化: converting a measured sample into one of the available digital levels.

With a low sample resolution, there are fewer levels, so each sample may be rounded more noticeably. With a higher sample resolution, there are more possible levels, so the stored value can be closer to the measured amplitude.

Common mistake

A higher sample resolution does not take more samples per second. It gives each sample more possible values.

The computer also needs recording information

Stored sample values need context. Software must know how quickly to play them back and how each sample should be interpreted.

Metadata 元数据: data about the sound data, such as sample rate, sample resolution, length or number of channels.
Information Why it matters
Sample rate Controls how many stored samples are played each second
Sample resolution Shows how many bits should be read for each sample value
Length Helps calculate or interpret the duration of the recording
Number of channels Shows whether the recording is mono, stereo or another format

Common mistake

Playing the same sample data with the wrong sample rate could change the speed or pitch of the sound.

Choosing suitable recording settings

Higher settings are not always the best choice. The purpose of the recording matters.

Scenario Suitable priority Reason
Short voice note for a classroom app Smaller file size Speech may still be understandable with moderate settings
Music recording for a performance archive Higher accuracy More detail in the sound should be preserved
Emergency alert tone Clarity and quick transmission The message must be recognisable without wasting bandwidth
Sound effect in a small game Balance between quality and storage Many sound effects may need to fit inside the application

Use the scenario

In an exam-style explanation, link your choice to the situation. For example, a voice alert may not need the same accuracy as a music recording.

Interactive: Sound Sampling Visualiser

Change the rate and resolution independently. Watch where measurements are taken and how each measurement is rounded to an available digital level.

Normal
Press Animate sampling to reveal the measurement and quantisation process.

Practice

Core questions

  1. Define the term sample.
  2. Explain why a sound wave must be sampled before it can be processed by a computer.
  3. Define the term sample rate.
  4. A recording uses a sample rate of 8000 Hz. How many samples are taken in 12 seconds?
  5. Define the term sample resolution.
  6. Calculate how many amplitude levels can be represented using 5 bits per sample.
  7. Explain how increasing the sample rate can improve recording accuracy.
  8. Explain why increasing the sample rate also increases file size.
  9. Explain how increasing sample resolution can improve recording accuracy.
  10. Explain why increasing sample resolution also increases file size.
  11. A short mono sound uses 20 samples per second for 4 seconds. Each sample uses 6 bits. Calculate the number of bits of sample data.
  12. Explain why a recording may need metadata such as sample rate and sample resolution.

Extension questions

  1. A student says, “A higher sample rate means each sample has more bits.” Explain the error.
  2. A 2-second mono recording uses 10 000 samples per second and 8 bits per sample. Calculate the number of bits of sample data.
  3. A recording changes from 8-bit samples to 16-bit samples while keeping the same sample rate and length. Explain the effect on accuracy and file size.
  4. A voice alert must be transmitted quickly over a slow connection. Explain why very high sample rate and resolution may not be suitable.
Check selected answers
  1. 8000 × 12 = 96 000 samples.
  2. 5 bits provide 25 = 32 amplitude levels.
  3. 20 × 4 × 6 = 480 bits of sample data.
  4. 10 000 × 2 × 8 = 160 000 bits of sample data.
  5. 16-bit samples provide 216 = 65 536 amplitude levels.

Review

Key ideas

  • Sound is originally a changing wave.
  • A computer represents sound by storing sampled measurements as binary data.
  • A sample is one measurement of the wave.
  • Sample rate is the number of samples taken each second.
  • Sample resolution is the number of bits used for each sample.
  • A higher sample rate can record the wave shape more accurately.
  • A higher sample resolution can represent amplitude more accurately.
  • Increasing either sample rate or sample resolution increases the amount of data.
  • Stored sound data may need metadata such as sample rate and resolution.

Quick self-check

  1. Can I explain what sampling does?
  2. Can I distinguish sample rate from sample resolution?
  3. Can I explain why increasing sample rate improves accuracy?
  4. Can I explain why increasing sample resolution improves accuracy?
  5. Can I explain why higher settings increase file size?

One-minute exit task

Explain why a sound recorded at 16 000 Hz with 8-bit samples needs more sample data than the same sound recorded at 8000 Hz with 8-bit samples.