Fundamentals of data representation - AQARepresenting sound

All data is represented as binary digits, whether it is numbers, text, images or sound. Calculations are also made in binary.

Part ofComputer ScienceComputational thinking and problem solving

Representing sound

Computers work in . All must be converted into binary in order for a computer to process it. Sound is no exception. To do this, analogue sound is captured, usually by a microphone, and then converted into a digital signal.

How computers process and represent sound

Converting sound to digital form

An analogue-to-digital converter will capture a sound wave at regular time intervals by measuring the height (amplitude) of the sound wave. This measurement is known as a .

For example, a sound wave like this can be sampled at each time sample point:

A sound wave

The sound recorded at each sample point is converted to its nearest numeric equivalent:

Sample12345678910
Decimal8376972666
Binary1000001101110110100101110010011001100110
SampleDecimal
18
23
37
46
59
67
72
86
96
106
SampleBinary
11000
20011
30111
40110
51001
60111
70010
80110
90110
100110

This data is then stored in a file for later use.

Sample rate

is the number of samples recorded per second. The higher the sample rate, the closer the recorded signal is to the original. Sample rate is measured in .

If the samples recorded above were plotted on a graph, the resulting representation of the sound wave would not be too accurate:

A sound wave with a low sample rate
Figure caption,
A sound wave plotted from 10 samples

However, if the sample rate is doubled (twice as many samples in the same time period), the resulting representation would be closer:

A sound wave with a doubled sample rate
Figure caption,
A sound wave plotted from 20 samples

However, the higher the sample rate, the larger the resulting file. As a result, sound files are often a compromise between quality and size of file.

Sampling resolution

Sampling resolution refers to the number of used to record each sample. For audio, the higher the sampling resolution, the more accurately a sound can be recorded, but the larger the file size. Typical bit depths are 16 bit and 24 bit.

File size (bits) = sample rate x sample resolution x number of seconds.

For example, to calculate the file size of a 2 minute audio file with a sample rate of 44.1kHz and a sample resolution of 16 bits:

2 minutes is 120 seconds

44100 x 16 x 120 = 84,672,000 or 84 M bits.