Representing sound
Computers work in binaryA number system that contains two symbols, 0 and 1. Also known as base 2.. All dataUnits of information. In computing there can be different data types, including integers, characters and Boolean. Data is often acted on by instructions. 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 sampleA digitally recorded fragment of sound, taken from an existing track or sound environment..
For example, a sound wave like this can be sampled at each time sample point:
The sound recorded at each sample point is converted to its nearest numeric equivalent:
| Sample | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| Decimal | 8 | 3 | 7 | 6 | 9 | 7 | 2 | 6 | 6 | 6 |
| Binary | 1000 | 0011 | 0111 | 0110 | 1001 | 0111 | 0010 | 0110 | 0110 | 0110 |
| Sample | Decimal |
|---|---|
| 1 | 8 |
| 2 | 3 |
| 3 | 7 |
| 4 | 6 |
| 5 | 9 |
| 6 | 7 |
| 7 | 2 |
| 8 | 6 |
| 9 | 6 |
| 10 | 6 |
| Sample | Binary |
|---|---|
| 1 | 1000 |
| 2 | 0011 |
| 3 | 0111 |
| 4 | 0110 |
| 5 | 1001 |
| 6 | 0111 |
| 7 | 0010 |
| 8 | 0110 |
| 9 | 0110 |
| 10 | 0110 |
This data is then stored in a file for later use.
Sample rate
sample rateHow many samples of data are taken per second. This is normally measured in hertz, eg an audio file usually uses samples of 44.1 kHz (44,100 audio samples per second). 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 HertzThe unit of frequency, symbol 'Hz'. 1 Hz is 1 wave or cycle per second..
If the samples recorded above were plotted on a graph, the resulting representation of the sound wave would not be too accurate:
However, if the sample rate is doubled (twice as many samples in the same time period), the resulting representation would be closer:
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 bitThe smallest unit of data in computing represented by a 1 in binary. 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.