Representing sound in a computer system requires the data about the sound to be converted into a digital format. Before we understand how to convert the data, we must first understand how a sound wave works.
Sound waves can either be analogue or digital.
An analogue wave is a continuous, smooth wave which replicates the original sound.
A digital wave is a set of discreet steps which represent the meansurements taken from the original analogue sound.
Let’s look an an analogue soundwave in more detail. In the example below, you can see that the height of the wave is labelled amplitude, and the length of the wave is labelled frequency. Both of these measurements are important to capturing the shape of the wave in a digital format.
To create the digital wave, the height (amplitude) is measured and saved as a binary number using a ADC (Analogue to Digital Converter) inside a device such as a microphone. This measurement is known as a sample.
The rate at which these measurements are taken are measured in samples per second and called the sample rate. Later on, you may come across a theorum that identifies what the sample rate should be – this is known as Nyquist Theorum (Nye-quist). This states that the sample rate should be twice the highest frequency of the sound wave to allow the whole wave to be captured.
Once the samples have been saved, they can be reconstructed into an analogue wave by passing the measurements back through an DAC (Digital to Analogue Converter) which recreates the soundwave in an output device such as a speaker.