Menu

Sound

Sampling

Sampling is the process that turns a continuously changing analogue sound wave into digital data a computer can store. A microphone produces a smoothly varying voltage, but a computer can only keep numbers, so the wave has to be measured again and again.

Measuring the amplitude

At regular intervals, the sampler measures the amplitude of the wave — how far the wave is from its resting position at that exact moment, which is how loud the sound is at that instant. It is the amplitude that is measured, not the pitch or frequency of the sound. The sampler does not count how many waves pass each second.

A smooth analogue sound wave measured at five equally spaced sample points, with a stepped digital line showing each stored height held until the next sample.

Storing the samples

Each measurement is converted into a binary number and stored. A sound file stores these samples, saved one after another in the order they were taken, so the computer can later work out which measurement came first, second and so on.

For example, a tiny recorder might store five measurements of a dog barking as 001, 111, 100, 010, 000. On its own each number means little; in sequence they show the loudness shooting up to a peak as the bark starts and then fading away.

Playing the sound back

On playback, the stored measurements are joined back together to recreate the shape of the wave. The result is an approximation of the original, not an exact copy, for two reasons. Anything the wave did between two samples was never recorded, so the computer has to fill in that gap by joining the known measurements together. Also, each measurement was rounded to one of the fixed levels available, so a value that fell between two levels was pushed to the nearest one.

Taken together, this means a digital recording captures the shape of the sound closely enough to sound right, while still being a slight simplification of what the microphone actually heard.

Practise this

OCR GCSE Computer Science · Units and File Sizes