Recording sound

Martin McBride, 2016-12-09
Tags analogue to digital converter quantisation
Categories data representation sound

When you record a sound from a microphone your computer or other device, it goes through the following stages:

The sound hardware takes the signal from the microphone and converts it to digital form. The recording software takes the digital sound information, and stores it to disk as a sound file.

Sound hardware

The sound hardware consists of an amplifier and an analogue to digital converter (ADC)

Most devices have built in recording hardware, although with a PC you can use a separate sound card to obtain higher quality.

If you use a USB microphone, the conversion hardware is included in the microphone itself, and the sound is digitised before it is sent over the USB connection. Your computer sound hardware will be bypassed in that case.

Amplifier

The signal from most microphones is very weak, so it is amplified before it is digitised. This creates an electrical signal which represents the sound waveform.

Analogue to Digital Converter

The electrical signal is called a continuous signal, because its value changes all the time. To create a digital sound we must measure the value at certain pints in time. So instead of having a signal that changes continuously in time, we have a series of "snapshots" of the value at particular points in time. This process is called sampling. Typically we would sample thousands of times per second, for example the digital sound on a CD is samples

The electrical signal also has a continuous value - the voltage can be any value (within the minimum and maximum values allowed). When we digitise the signal, we only allow a fixed set of values. For example:

Here the input signal (voltage) can have any value between 0.0 and 1.0. When we sample the signal, we only allow a certain number different levels, in this case 8. We pick the closest level to the actual value - it might not be exactly right, but it is a close approximation. This is called quantisation.

If we use 8 levels, it means that each value can be stored as a 3 bit quantity. In fact we would never use 8 levels, the quality would be very poor (8 is just used to make the diagram simpler). Usually we use 65536 levels, so each sample takes 16 bits, or 2 bytes.

Sound recording software

The sound hardware produces sound data as raw, unformatted data in memory. The job of the sound recording software is to control the process (staring and stopping the recording), and to write the data to disk in a standard format such as WAV or MP3.