CS  ·  Computer Systems

Data Representation: Sound

Computer Systems  ·  Lesson 4 of 10 Extension topic  ·  not assessed in SQA exam ~40 minutes
Learning intentions
  • Understand that sound is an analogue signal that must be converted to digital for computer storage
  • Describe the process of sampling an analogue sound wave
  • Explain what sampling frequency (sample rate) means and how it affects quality
  • Explain what bit depth means in the context of sound and how it affects quality
  • Calculate the file size of a digital audio recording
  • Compare WAV and MP3 audio file formats in terms of compression, quality, and file size
Success criteria
  • I can explain what analogue and digital signals are, and why conversion is needed
  • I can describe what sampling frequency means and give the standard CD sampling rate
  • I can explain how higher sampling frequency and bit depth improve quality but increase file size
  • I can calculate the file size of a digital audio file given sample rate, bit depth, and duration
  • I can compare WAV and MP3, stating that WAV is uncompressed and MP3 is lossy compressed
Warm up — what do you already know?

Answer before the lesson begins. These check prior knowledge — it's fine if you're unsure.

1. In bitmap graphics, what term describes the number of bits used per pixel?

2. A bitmap image is 100 × 50 pixels with a bit depth of 8. What is its file size in bits?

3. Which of the following is an example of an analogue signal?

Key vocabulary

Analogue signal
A continuously varying signal (like a sound wave in air) that can take any value within a range.
Digital signal
A signal represented by discrete (step-by-step) values — in computing, always 1s and 0s.
ADC
Analogue-to-Digital Converter; the hardware that measures (samples) an analogue signal and converts it to binary numbers.
Sampling
The process of measuring the amplitude of an analogue sound wave at regular intervals.
Sampling frequency
The number of times per second a sound is sampled; measured in Hertz (Hz) or kilohertz (kHz). CD quality is 44,100 Hz (44.1 kHz).
Bit depth
The number of bits used to store each sample; determines how accurately the amplitude is recorded. Higher bit depth = more accurate = larger file.
File size (audio)
Calculated as: sampling frequency × bit depth × duration (in seconds). For stereo, multiply by 2.
WAV
Waveform Audio File Format; typically uncompressed, very high quality, large file size.
MP3
A lossy compressed audio format; reduces file size to ~10% of WAV by removing sounds humans are less likely to notice.

Data Representation: Sound

Sound is analogue — computers are digital

Sound is produced by vibrations in the air — pressure waves that travel to your ears and vibrate the eardrum. This is an analogue signal: it varies continuously and smoothly, taking any value along a continuous range. A microphone converts these pressure waves into an electrical signal that mirrors the shape of the original wave.

Computers, however, can only work with digital data — discrete values stored as binary numbers. To store or process sound on a computer, the continuous analogue signal must be converted into a series of numbers. This is done by a hardware component called an Analogue-to-Digital Converter (ADC).

Sampling — measuring the wave

The ADC measures (samples) the amplitude (height) of the sound wave at regular intervals. Each measurement is stored as a binary number. The more frequently the wave is measured, and the more precisely each measurement is recorded, the more accurately the digital version recreates the original sound.

An analogue sound wave (green curve) measured at regular intervals. Each dot is one sample, stored as a binary number.

Sampling frequency is the number of samples taken per second, measured in Hertz (Hz) or kilohertz (kHz). Common values:

  • CD audio: 44,100 Hz (44.1 kHz) — the industry standard for music
  • DVD / studio audio: 48,000 Hz or 96,000 Hz
  • Telephone / voice: 8,000 Hz — adequate for speech, noticeably poor for music

The Nyquist theorem states that sampling frequency must be at least twice the highest frequency you want to capture. Humans can hear up to roughly 20,000 Hz, so a minimum sample rate of 40,000 Hz is needed — CD audio at 44.1 kHz satisfies this with a small margin.

Bit depth — accuracy per sample

Each sample is stored as a binary number. The number of bits used per sample is called the bit depth. A higher bit depth means each amplitude measurement can be recorded more precisely:

  • 8-bit audio: 28 = 256 possible amplitude values — audible "stepping" artefacts
  • 16-bit audio (CD standard): 216 = 65,536 possible values — the steps are imperceptibly small
  • 24-bit audio (studio recording): 224 ≈ 16.7 million values

Increasing bit depth increases accuracy and therefore sound quality — but also increases file size, since more bits are stored per sample.

Calculating audio file size

The file size of an uncompressed audio file is calculated with the formula:

File size (bits) = sampling frequency × bit depth × duration (seconds)

For stereo (two independent audio channels — left and right speaker), multiply the result by 2.

Example: a 3-minute (180-second) stereo WAV file at 44,100 Hz and 16-bit depth:
= 44,100 × 16 × 180 × 2 = 254,016,000 bits = 31,752,000 bytes ≈ 30.3 MB

This is why uncompressed audio files are large, and why compression formats like MP3 were developed.

File formats — WAV and MP3

WAV (Waveform Audio File Format) stores audio with no compression applied. Every sample is saved exactly as recorded. This gives very high quality but large file sizes — suitable for studio recording and professional audio editing, but impractical for streaming or storing large music libraries.

MP3 is a lossy compressed format. It reduces file size to roughly 10% of the equivalent WAV by permanently removing audio data that humans are statistically unlikely to notice:

  • Sounds at the very high and low extremes of human hearing are removed
  • When two sounds occur simultaneously and one is much louder, the quieter sound may be discarded (the masking effect)

The result is a much smaller file with acceptable quality for most listeners. A 30 MB WAV file might compress to ∼3 MB as MP3. The critical trade-off is that the removed data is permanently lost — you cannot recover a lossless version from an MP3.

PropertyWAVMP3
CompressionNone (uncompressed)Lossy compression
QualityVery high — no data removedGood — some perceptual data lost
File sizeLarge (∼30 MB per 3 min)Small (∼3 MB per 3 min)
Typical useStudio recording, editingMusic streaming, portable devices
Data lossNonePermanent — cannot be undone

Worked examples

Example 1 — File size calculation (mono)

A 10-second mono audio recording is made at a sampling frequency of 8,000 Hz and a bit depth of 8. Calculate the file size in bits and bytes.

1
Write the formula: File size (bits) = sampling frequency × bit depth × duration
2
Substitute values: 8,000 × 8 × 10 = 640,000 bits
3
Convert to bytes: 640,000 ÷ 8 = 80,000 bytes (80 KB)
Example 2 — File size calculation (stereo)

A 1-minute stereo recording is made at 44,100 Hz and 16-bit depth. Calculate the file size in bits.

1
Convert duration to seconds: 1 minute = 60 seconds
2
Calculate mono file size: 44,100 × 16 × 60 = 42,336,000 bits
3
Multiply by 2 for stereo (two channels): 42,336,000 × 2 = 84,672,000 bits ≈ 10.1 MB
Example 3 — Effect of changing sample rate

A recording is made at 44,100 Hz. A second identical-length recording is made at 22,050 Hz (half the sample rate). How does this affect file size and quality?

1
File size: Halving the sampling frequency halves the number of samples stored per second — so the file size is halved.
2
Quality: Fewer samples means the reconstructed wave is less accurate — the digital version loses detail, particularly at higher frequencies. Quality decreases noticeably.
3
Trade-off: Lower sample rate → smaller file + lower quality. Higher sample rate → larger file + higher quality. Neither change is free.
Example 4 — Comparing WAV and MP3 file sizes

A 5-minute song is saved as a WAV file (44,100 Hz, 16-bit, stereo). Estimate the MP3 file size at 10% of the WAV size.

1
Convert duration: 5 minutes = 300 seconds
2
WAV file size: 44,100 × 16 × 300 × 2 = 423,360,000 bits = 52,920,000 bytes ≈ 50.5 MB
3
MP3 estimate: 50.5 MB × 10% ≈ ∼5 MB — ten times smaller, at the cost of permanently lost audio data.
Now you try

A 30-second mono audio clip is recorded at a sampling frequency of 22,050 Hz with a bit depth of 16.

Calculate the file size in bits and in bytes. Show your working.

  1. Write the formula: File size (bits) = sampling frequency × bit depth × duration
  2. Substitute values: 22,050 × 16 × 30 = 10,584,000 bits
  3. Convert to bytes: 10,584,000 ÷ 8 = 1,323,000 bytes ≈ 1.26 MB
  4. Note: The question specifies mono — no ×2 needed.
Common mistakes
Forgetting to multiply by 2 for stereo. Stereo recordings have TWO channels — left and right. Always check whether a question specifies mono or stereo before applying the formula.
Confusing sampling frequency with bit depth. Sampling frequency = how often you measure (samples per second). Bit depth = how precisely you measure (bits per sample). Both affect quality and file size, but through different parts of the formula.
Saying "MP3 is better quality than WAV." MP3 is smaller, not better quality. MP3 permanently discards audio data. WAV retains every sample exactly as recorded. The right choice depends on the use case.
Applying the formula in the wrong order. The formula is: frequency × bit depth × duration (× 2 for stereo). Always write it out before substituting values to avoid multiplication errors.
Using minutes instead of seconds. Duration in the formula must be in seconds. Always convert before calculating — e.g. 3 minutes = 180 seconds.
Exam tip

This is an extension topic — it does not appear in the mandatory N5 SQA Computer Systems exam specification. However, audio concepts (sampling, bit depth, WAV vs MP3) do appear in the WDD unit specification under "Factors affecting file size and quality". If you choose the WDD question in the exam, this content is directly relevant.

The file size calculation method is identical in structure to bitmap graphics — both use: quantity × bit depth × time or area. Recognising this pattern makes both topics easier to remember and apply.

Task Set

Questions 1–4 are auto-checked. Questions 5–8 are self-marked — write your answer, then reveal the model answer to check your work.

1. What does ADC stand for in the context of audio recording? TYPE 1

2. Which of the following sampling frequencies is used for CD-quality audio? TYPE 1

3. What is the effect of increasing the bit depth of an audio recording? TYPE 1

4. An audio file has a sampling frequency of 44,100 Hz and a bit depth of 16. How many bits are stored per second for a mono recording? TYPE 1

5. Describe the process of sampling an analogue sound wave. TYPE 2

Sampling is the process of measuring (recording) the amplitude (height) of an analogue sound wave at regular intervals. Each measurement is stored as a binary number. The sampling frequency determines how many measurements are taken per second. The more frequently the wave is sampled, the more accurately the digital version represents the original sound.

6. Explain the difference between WAV and MP3 audio file formats. TYPE 2

WAV is an uncompressed audio format that stores every sample exactly as recorded, resulting in very high quality but large file sizes. MP3 is a lossy compressed format that removes audio data humans are unlikely to notice (e.g. very high/low frequencies, quiet sounds masked by louder ones), reducing file size to approximately 10% of WAV. The trade-off is permanently reduced quality in exchange for much smaller files.

7. A 2-minute stereo recording is made at 44,100 Hz with a 16-bit bit depth. (a) Calculate the file size in bits. (b) Calculate the file size in megabytes (divide by 8 for bytes, then by 1,048,576 for MB). (c) Estimate the file size if saved as MP3. TYPE 3

(a) 44,100 × 16 × 120 × 2 = 169,344,000 bits
(2 min = 120 sec; ×2 for stereo)

(b) 169,344,000 ÷ 8 = 21,168,000 bytes; ÷ 1,048,576 ≈ 20.2 MB

(c) MP3 ≈ 10% of WAV ≈ ∼2 MB

8. Explain how sampling frequency and bit depth each affect (a) audio quality and (b) file size. Use specific examples in your answer. TYPE 3

Sampling frequency:
Quality — a higher sampling frequency captures more of the original wave's detail. CD audio at 44,100 Hz captures all frequencies the human ear can detect. A lower frequency such as 8,000 Hz (telephone quality) misses high-frequency information, making music sound thin or muffled.
File size — higher sampling frequency increases file size because more samples are stored per second.

Bit depth:
Quality — more bits per sample means more precise amplitude measurements. 16-bit audio (65,536 amplitude levels) is far more accurate than 8-bit (only 256 levels), which produces audible stepping artefacts.
File size — higher bit depth increases file size because each sample requires more bits of storage.
Teacher notes — Shift+T to hide

Suggested timing: ~40 minutes. Warm up 5 min; notes + diagram 15 min; worked examples 8 min; now you try 4 min; task set 8 min.

Extension status: This lesson is not assessed in the SQA N5 Computer Systems exam. Deliver it if time allows after CS3 (Graphics). It is worthwhile because audio file concepts (sampling frequency, bit depth, WAV vs MP3) appear in the WDD unit specification — pupils choosing WDD in the exam benefit directly.

Key connection to reinforce: The file size formula is structurally identical to the bitmap formula (pixels × bit depth). Making this explicit is powerful — it shows pupils the same underlying principle at work in two different contexts: "how many things × how many bits each". This cross-unit connection strengthens retention.

Key misconception to address: Pupils often say "MP3 is better quality than WAV" because it is more familiar. Correct this clearly: MP3 is smaller, not better. WAV retains all data; MP3 permanently discards some. Also watch for pupils forgetting the ×2 for stereo.

Live demo suggestion: Play the same audio clip as high-quality WAV vs heavily compressed MP3 — pupils can hear the difference, which motivates the theory. Audacity (free) lets you export at different quality settings side by side.

The Nyquist theorem: Background knowledge appropriate at this level; will not be examined at N5. Keep brief. Telephone quality at 8 kHz is a useful hook — pupils can relate to voice calls sounding different from music.

SQA command words covered: "Describe" (sampling process), "Explain" (WAV vs MP3, effect of parameters on quality and file size), "Calculate" (file size formula).