Units and data representation - OCRSound

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

Part ofComputer ScienceComputer systems

Sound

How sound can be sampled and stored in digital form

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

How computers process and represent sound

An analogue-to-digital converter will capture a sound wave at regular time intervals. This recording is known as a .

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

A sound wave
Figure caption,
A sound wave sampled at 10 sample points of time

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

Sample12345678910
Denary8376972666
Binary1000001101110110100101110010011001100110
SampleDenary
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.

The effect of sample rate, duration and bit depth on the playback quality and size of a sound file

is the number of samples recorded in any given period of time. The higher the sample rate, the closer the recorded signal is to the original. Sample rate is measured in (Hz).

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. An audio file is usually recorded at 44.1 kiloHertz (kHz). This is high enough for good sound quality while keeping file size down to sensible levels.

Bit depth

refers to the number of used to record each sample. Just as with images, the higher the bit depth, the more accurately a sound can be recorded, but the larger the file size. Typical bit depths are 16 bit and 24 bit.

Bit rate

is simply a measure of how much data is processed for each second of sound.

Bit rate = sample rate x bit depth

As with sample rate, the higher the bit rate, the better quality of the recorded sound.

File size

File size depends on the (samples per second), sample resolution (bits per sample), length (in seconds) and the number of channels (1 for mono, 2 for stereo.)

File size = sample rate x sample resolution x time x number of channels.

Example

A 10-second stereo clip sampled at 44,100 Hz using 16-bit resolution:

10 x 2 x 44,100 x 16 = 14,112,000 bits

To work out the file size in bytes, divide the answer by 8, as there are 8 bits in a byte.

Therefore, 14,112,000 / 8 = 1,764,000 bytes or 1.76 MB.