x

Revision notes for Edexcel GCSE Computer Science Representing analogue sound in binary. Open the guide for explanations and worked examples. Written against the Edexcel GCSE Computer Science (1CP2) specification, so the content matches what's examinable rather than general Computer Science background.

Representing analogue sound in binary

What you'll learn

  • Why real-world sound is analogue, but computers store it as binary.
  • How amplitude is measured using regular samples.
  • The difference between sample rate, sample interval, and bit depth.
  • How these choices affect sound quality and file size.

The problem: sound is analogue, computers are digital

When you speak, clap, or play music, the air vibrates. A microphone can turn those vibrations into an electrical signal that changes smoothly over time.

Computers cannot directly store a perfectly smooth, continuous signal. They store data using binary: patterns of 0s and 1s. So, to store sound, the computer must create a digital approximation of the original sound wave.

Definition

Analogue sound

An analogue sound signal is continuous: it can change smoothly over time and its amplitude can take any value within a range.

Definition

Binary

Binary is a base-2 number system that uses only two digits: 0 and 1. Each binary digit is called a bit.

Key Idea

The big idea

A computer represents analogue sound by measuring the sound wave many times per second, then storing each measured amplitude as a binary number.

Amplitude: the height of the sound wave

The amplitude of a sound wave is its height from the centre line at a particular moment.

For GCSE Computer Science, you should link amplitude to loudness:

  • larger amplitude usually means a louder sound
  • smaller amplitude usually means a quieter sound

Amplitude is not the same as pitch. Pitch is about how quickly the wave repeats; amplitude is about the wave’s height.

Definition

Amplitude

Amplitude is the size or height of a sound wave at a particular point in time. In digital sound, the amplitude is the value being sampled and stored.

Common Mistake

Amplitude is not pitch

Do not write that higher amplitude means higher pitch. Higher amplitude means louder sound; pitch depends on frequency, which is a different idea.

Sampling: taking regular measurements

To store sound, the computer does not store the whole smooth wave. Instead, it takes measurements at regular points in time. Each measurement is called a sample.

Definition

Sample

A sample is one measurement of the sound wave’s amplitude at a particular moment.

The diagram below shows a smooth analogue wave being sampled at regular intervals. Each dot is a sample, and each sample’s amplitude is converted into a digital value.

Diagram showing analogue sound sampling with amplitude, sample interval, sample rate, and bit depth

Sample interval

The sample interval is the time gap between two neighbouring samples.

For example, if a computer measures the sound every 0.001 seconds, then the sample interval is 0.001 seconds.

Definition

Sample interval

The sample interval is the time between one sample and the next sample.

Sample rate

The sample rate is the number of samples taken each second. It is usually measured in hertz, written as Hz. A sample rate of 8000 Hz means 8000 samples are taken every second.

Definition

Sample rate

The sample rate is the number of sound samples taken per second.

Sample interval and sample rate are closely connected:

sample rate=1sample interval in seconds\text{sample rate} = \frac{1}{\text{sample interval in seconds}}sample rate=sample interval in seconds1​

and:

sample interval=1sample rate\text{sample interval} = \frac{1}{\text{sample rate}}sample interval=sample rate1​
Example

Converting sample interval to sample rate

A sound is sampled every 0.00025 seconds. Find the sample rate.

  1. Use the reciprocal relationship because the sample interval tells you the time for one sample, but the sample rate asks how many samples fit into one second.

    sample rate=1sample interval\text{sample rate} = \frac{1}{\text{sample interval}}sample rate=sample interval1​
  2. Substitute the sample interval of 0.00025 seconds.

    sample rate=10.00025\text{sample rate} = \frac{1}{0.00025}sample rate=0.000251​
  3. Calculate the value and add the correct unit.

    sample rate=4000\text{sample rate} = 4000sample rate=4000

    The sample rate is 4000 Hz.

Tip

Sample rate sanity check

A smaller sample interval means samples are closer together, so the sample rate must be higher. A larger sample interval means fewer samples per second.

Bit depth: how many bits per sample?

Once a sample has been taken, its amplitude must be stored as a binary number. The bit depth tells you how many bits are used for each sample.

Definition

Bit depth

Bit depth is the number of bits used to store the amplitude of one sound sample.

If the bit depth is higher, the computer has more possible binary values available for each sample. This means it can represent the amplitude more accurately.

The number of possible amplitude levels is:

number of amplitude levels=2bit depth\text{number of amplitude levels} = 2^{\text{bit depth}}number of amplitude levels=2bit depth

So:

Bit depthPossible amplitude levelsExample binary range
1 bit2 levels0 to 1
2 bits4 levels00 to 11
3 bits8 levels000 to 111
8 bits256 levels0000 0000 to 1111 1111

With 8-bit samples, there are 256 possible codes. For example, one sampled amplitude level could be stored as 1010 0110.

Example

Finding amplitude levels

A sound recording uses a bit depth of 8 bits per sample. How many different amplitude levels can it store?

  1. Use the rule that each bit has two possible values, so the number of levels is found using a power of 2.

    levels=2bit depth\text{levels} = 2^{\text{bit depth}}levels=2bit depth
  2. Substitute the bit depth of 8.

    levels=28\text{levels} = 2^8levels=28
  3. Calculate the result.

    28=2562^8 = 25628=256

    The recording can store 256 different amplitude levels for each sample.

Quantisation: rounding to a digital level

A real analogue amplitude could be almost any value. But a fixed bit depth only gives a fixed number of possible values.

This means the measured amplitude usually has to be rounded to the nearest available digital level. This rounding process is called quantisation.

Definition

Quantisation

Quantisation is the process of rounding a sampled analogue amplitude to the nearest value that can be represented using the available bit depth.

A higher bit depth gives more available levels, so the rounded value is usually closer to the original analogue amplitude. This improves the accuracy of the sound representation.

Example

Encoding sampled amplitudes

A simple recording uses 4-bit samples. Four sampled amplitudes have been rounded to denary levels 2, 7, 12, and 15. Show how they would be stored in binary.

  1. Use 4 bits for every sample because the bit depth is 4. This means each stored value must be written using exactly four binary digits.

  2. Convert each denary amplitude level into a 4-bit binary value: 2 becomes 0010, 7 becomes 0111, 12 becomes 1100, and 15 becomes 1111.

  3. Store the samples in time order, so the binary sound data is:

    0010 0111 1100 1111

Common Mistake

Mixing up sample rate and bit depth

Sample rate is about how often measurements are taken along the time axis. Bit depth is about how many possible amplitude values each measurement can be rounded to.

How sample rate and bit depth affect quality

A digital sound recording is only an approximation of the original analogue sound.

Increasing the sample rate means the computer takes more measurements per second. This captures changes in the wave more frequently.

Increasing the bit depth means each amplitude measurement can be stored using more possible values. This reduces rounding error.

FeatureWhat it controlsIf increased
Sample rateNumber of samples per secondMore detail over time
Sample intervalTime between samplesShorter interval gives more samples
Bit depthBits used per sampleMore possible amplitude levels
AmplitudeHeight of the waveLarger value means louder sound
Key Idea

Quality versus storage

Higher sample rate and higher bit depth usually improve sound quality, but they also increase the amount of data that must be stored.

Calculating sound data size

For uncompressed sound data, the file size depends on:

  • sample rate
  • duration
  • bit depth

For one channel of sound:

size in bits=sample rate×duration in seconds×bit depth\text{size in bits} = \text{sample rate} \times \text{duration in seconds} \times \text{bit depth}size in bits=sample rate×duration in seconds×bit depth

Then convert:

  • 8 bits = 1 byte
  • 1 KiB = 1024 bytes
Example

Estimating sound data size

A 10-second sound is sampled at 8000 Hz using a bit depth of 8 bits. Calculate the size of the sound data in KiB.

  1. Find the number of samples by multiplying the sample rate by the duration.

    samples=8000×10=80000\text{samples} = 8000 \times 10 = 80000samples=8000×10=80000
  2. Find the number of bits by multiplying the number of samples by the bit depth.

    bits=80000×8=640000\text{bits} = 80000 \times 8 = 640000bits=80000×8=640000
  3. Convert bits to bytes by dividing by 8.

    bytes=640000÷8=80000\text{bytes} = 640000 \div 8 = 80000bytes=640000÷8=80000
  4. Convert bytes to KiB by dividing by 1024.

    KiB=80000÷1024≈78.1\text{KiB} = 80000 \div 1024 \approx 78.1KiB=80000÷1024≈78.1

    The sound data is about 78.1 KiB.

Common Mistake

Using 1000 bytes for a KiB

For Edexcel GCSE Computer Science, use binary units: 1 KiB = 1024 bytes, not 1000 bytes.

The full process

Putting it all together, analogue sound is represented in binary like this:

  1. A microphone detects the analogue sound wave.
  2. The computer measures the wave’s amplitude at regular time intervals.
  3. Each measurement is a sample.
  4. Each sample is rounded to one of the available amplitude levels.
  5. The chosen level is stored as a binary number.
  6. The sequence of binary numbers represents the sound over time.

The stored sound is not the original smooth wave. It is a digital approximation made from lots of binary amplitude values.

Exam technique

In the exam

  1. Keep the axes separate: sample rate and sample interval are about time; amplitude and bit depth are about the height/value of each sample.
  2. If you are given a sample interval, convert it to seconds if needed, then use the reciprocal to find the sample rate.
  3. For bit depth, use powers of 2 for amplitude levels; for file size, multiply sample rate by duration by bit depth, then convert bits to bytes and bytes to KiB if asked.
Self review

Check yourself

  • What is the difference between sample rate and bit depth?
  • If the sample interval gets smaller, what happens to the sample rate?
  • How many possible amplitude levels can be represented using 6-bit samples?
You've reached the end

Test yourself on this topic, or move on to the next guide.

FlashcardsSelf-test with active recall
Limitations of binary representationUp next

How was this guide?

Representing analogue sound in binary Revision Guide

  1. GCSE
  2. /Computer Science
  3. /Representing analogue sound in binary