CS21: Representing Sound
How sound is converted from analogue to digital using sampling, and how sampling rate and resolution affect quality and file size.
How sound is converted from analogue to digital using sampling, and how sampling rate and resolution affect quality and file size.
Sound waves are continuous - they have smooth, unbroken curves that represent changes in air pressure over time. Computers cannot store continuous data; they work with discrete binary values. The solution is to measure the sound wave at regular intervals and record each measurement as a binary number. This process is called analogue-to-digital conversion (ADC).
Imagine drawing a smooth curve on graph paper. You can only mark points where grid lines cross. The more grid lines (higher sampling rate) and the finer the grid (higher resolution), the closer your dots will match the curve. With fewer, coarser dots, the recreation becomes blocky and inaccurate.
When digitising sound, the analogue wave is measured at regular intervals. The number of measurements taken every second is the sampling rate.
A sound wave sampled at 8,000 Hz takes 8,000 measurements every second. At 44,100 Hz, it takes 44,100 measurements every second - over 5 times as many. The higher rate captures more detail of the original sound wave, especially higher frequencies.
Each sample records the amplitude (height) of the sound wave at that point. The sample resolution determines how precisely the amplitude is measured:
| Sample Resolution | Bits per Sample | Number of Amplitude Values | Example Use |
|---|---|---|---|
| 8-bit | 8 | 256 | Telephone, basic audio |
| 16-bit | 16 | 65,536 | CD quality audio |
| 24-bit | 24 | 16,777,216 | Studio recording |
| 32-bit | 32 | 4,294,967,296 | Professional audio production |
With 8-bit resolution, each sample can be one of 256 values. With 16-bit resolution, each sample can be one of 65,536 values. The finer resolution means the digital recording is much closer to the smooth original wave, producing less quantisation noise and better dynamic range.
Calculate the file size of a 3-minute stereo audio recording at CD quality (44,100 Hz, 16-bit).
Duration = 3 x 60 = 180 seconds
File size = 44,100 x 16 x 180 x 2
= 44,100 x 16 = 705,600
= 705,600 x 180 = 127,008,000
= 127,008,000 x 2 = 254,016,000 bits
= 254,016,000 / 8 = 31,752,000 bytes
= 31,752,000 / 1024 / 1024 = 30.28 MB
Calculate the file size of a 30-second mono recording at 8,000 Hz sample rate with 8-bit resolution.
File size = 8,000 x 8 x 30 x 1
= 64,000 x 30
= 1,920,000 bits
= 1,920,000 / 8 = 240,000 bytes
= 240,000 / 1024 = 234.375 KB
A 2-minute stereo recording at 22,050 Hz with 16-bit resolution. Calculate the file size in MB.
Duration = 2 x 60 = 120 seconds
File size = 22,050 x 16 x 120 x 2
= 22,050 x 16 = 352,800
= 352,800 x 120 = 42,336,000
= 42,336,000 x 2 = 84,672,000 bits
= 84,672,000 / 8 / 1024 / 1024 = 10.09 MB
| Change | Effect on Quality | Effect on File Size |
|---|---|---|
| Increase sampling rate | Improves (captures more detail, higher frequencies) | Increases (more samples per second) |
| Decrease sampling rate | Degrades (loss of high frequencies, aliasing) | Decreases |
| Increase sample resolution | Improves (more amplitude levels, less quantisation noise) | Increases (more bits per sample) |
| Decrease sample resolution | Degrades (more quantisation noise, reduced dynamic range) | Decreases |
| Use stereo instead of mono | Improves (spatial sound, richer audio) | Doubles (2 channels instead of 1) |
CD quality (44,100 Hz, 16-bit, stereo) for 1 minute = ~10.1 MB
Telephone quality (8,000 Hz, 8-bit, mono) for 1 minute = ~469 KB
CD quality is over 20 times larger but sounds dramatically better because it captures far more of the original sound detail.
| Mistake | Why It's Wrong | How to Fix It |
|---|---|---|
| Forgetting to multiply by number of channels | Stereo has 2 channels, doubling the data | Always include channels: mono=1, stereo=2 |
| Confusing sampling rate with sample resolution | Rate is how often; resolution is how precisely | Rate = samples per second (Hz); Resolution = bits per sample |
| Forgetting to convert minutes to seconds | The formula uses seconds, not minutes | Always multiply minutes by 60 first |
| Not converting bits to bytes when asked | Exam questions usually want KB or MB | Divide by 8 for bytes, then by 1024 for KB/MB |
| Saying "higher sampling rate = better quality" without explaining why | You need to explain the connection | More samples = closer to original wave = captures more detail |
Q1: Calculate the file size in MB of a 5-minute stereo recording sampled at 44,100 Hz with 16-bit resolution.
Q2: Explain why a higher sampling rate produces better quality sound.
Q3: What is the minimum sampling rate needed to accurately record a sound with a maximum frequency of 15,000 Hz?
Q4: A 60-second mono recording at 22,050 Hz with 16-bit resolution produces a file of how many kilobytes?
Q5: What is the difference between sampling rate and sample resolution?
โ Confusing sample rate and bit depth โ Sample rate is how many samples per second (Hz); bit depth is how many bits per sample. Both affect quality and file size, but they measure different things.
โ Thinking increasing sample rate alone guarantees CD-quality sound โ CD-quality requires BOTH a sample rate of 44,100 Hz AND a bit depth of 16 bits. High sample rate with low bit depth still sounds poor.
โ Forgetting to multiply by the number of channels (mono/stereo) for sound file size โ Stereo sound uses 2 channels, so the file size is double that of mono. Always check if the question specifies mono or stereo.
โ Not understanding the relationship between sample rate and Nyquist's theorem โ To accurately reproduce a sound, the sample rate must be at least twice the highest frequency in the sound (Nyquist rate). Human hearing goes to ~20kHz, so CD uses 44.1kHz.
A 3-minute stereo audio recording uses a sample rate of 44,100 Hz and a bit depth of 16 bits. Calculate the file size in megabytes. [3 marks]
Duration = 3 ร 60 = 180 seconds Samples per channel = 44,100 ร 180 = 7,938,000 Bits per sample = 16 Number of channels = 2 (stereo) File size in bits = 44,100 ร 180 ร 16 ร 2 = 254,016,000 bits File size in bytes = 254,016,000 รท 8 = 31,752,000 bytes File size in MB = 31,752,000 รท 1,048,576 = 30.28 MB The file size is approximately 30.28 MB.
AO1 (Computational Thinking โ 40%): Demonstrate knowledge and understanding of the principles and concepts of computer science, including representing sound: sample rate and bit depth for AQA 8525, OCR J277 & Edexcel 1CP2.
AO2 (Application โ 40%): Apply knowledge and understanding of computer science, including representing sound: sample rate and bit depth to analyse problems in computational terms and to design, write and evaluate solutions.
AO3 (Evaluation โ 20%): Evaluate the effectiveness, correctness and efficiency of computational solutions, including representing sound: sample rate and bit depth, and make reasoned judgements about trade-offs.
Get the best revision books and guides to boost your grades.