Recording sound

By 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:

sound-recording

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)

sound-recording

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.

sound-recording

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

sound-recording

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:

sound-recording

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

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.

See also

Sign up to the Creative Coding Newletter

Join my newsletter to receive occasional emails when new content is added, using the form below:

Popular tags

555 timer abstract data type abstraction addition algorithm and gate array ascii ascii85 base32 base64 battery binary binary encoding binary search bit block cipher block padding byte canvas colour coming soon computer music condition cryptographic attacks cryptography decomposition decryption deduplication dictionary attack encryption file server flash memory hard drive hashing hexadecimal hmac html image insertion sort ip address key derivation lamp linear search list mac mac address mesh network message authentication code music nand gate network storage none nor gate not gate op-amp or gate pixel private key python quantisation queue raid ram relational operator resources rgb rom search sort sound synthesis ssd star network supercollider svg switch symmetric encryption truth table turtle graphics yenc