PyGCSE Python Lab

Sound Sampling Visualiser

See how an analog sound wave is digitised by adjusting sample rate and bit depth. Watch quantisation in action and calculate file sizes. Covers AQA A Level CS (7517) §4.5.6.2.

📖 Learn Step-by-Step
16
Analog signal Sample points Digital reconstruction

Sampling Summary

Sample rate:16 samples
Bit depth:4 bits/sample
Quantisation levels:16

Total bits:16 × 4 = 64
Data size:8 bytes

File size for 1 second of audio

Formula:sample rate × bit depth × duration
Calculation:16 × 4 × 1
Result:64 bits = 8 bytes

file size = sample rate × bit depth × duration (seconds)
Higher sample rate → captures more detail in the waveform
Higher bit depth → more precise amplitude values

Quality vs size

Detail
Precision
File size
View sample data as binary
#TimeAnalogQuantisedLevelBinary
00.0000.50000.533381000
10.0670.87160.8667131101
20.1330.99731.0000151111
30.2000.79390.8000121100
40.2670.39600.400060110
50.3330.06700.066710001
60.4000.02450.000000000
70.4670.29660.266740100
80.5330.70340.7333111011
90.6000.97551.0000151111
100.6670.93300.9333141110
110.7330.60400.600091001
120.8000.20610.200030011
130.8670.00270.000000000
140.9330.12840.133320010
151.0000.50000.466770111

Sound Sampling Practice Questions

Q1

A sound file is recorded at a sample rate of 44,100 Hz with a bit depth of 16 bits for 3 seconds (mono). Calculate the file size in bytes.

0/2 marks
bytes
Q2

A sound is sampled with a bit depth of 8 bits. How many different amplitude levels can be represented?

0/1 mark
Q3

A sound wave has a maximum frequency of 20,000 Hz. According to the Nyquist theorem, what is the minimum sample rate needed to accurately reproduce this sound? Give your answer in Hz.

0/1 mark
Hz
Q4

A stereo audio file is recorded at 22,050 Hz, 16-bit depth, for 5 seconds. Stereo uses 2 channels. Calculate the file size in kilobytes (1 KB = 1024 bytes). Give your answer to the nearest whole number.

0/3 marks
KB
Q5

A podcast episode is 45 minutes long, recorded in mono at 22,050 Hz with a bit depth of 16 bits. Calculate the file size in megabytes (1 MB = 1024×1024 bytes). Give your answer to 1 decimal place.

0/3 marks
MB
Quick reference — sound sampling

Analogue to digital conversion (ADC):

  • Sound is a continuous (analogue) pressure wave
  • To store digitally, we sample the wave at regular intervals
  • Each sample's amplitude is quantised to the nearest available level

Key definitions:

  • Sample rate: number of samples taken per second (measured in Hz). CD quality = 44,100 Hz
  • Bit depth: number of bits per sample — determines the number of amplitude levels (2n). CD = 16-bit
  • Nyquist theorem: sample rate must be at least 2× the highest frequency to reconstruct the signal accurately

File size formula:

file size (bits) = sample rate × bit depth × duration (s)

Divide by 8 for bytes, ÷1024 for KB, etc.

Trade-offs:

  • ↑ Sample rate → captures more detail (higher frequencies) → larger file
  • ↑ Bit depth → more precise amplitudes → larger file
  • Compression (e.g., MP3) reduces file size with some loss of quality