Analogue-to-Digital Conversion
Every time you record a voice memo, stream a song or make a phone call, a continuously-varying analogue sound wave is being chopped up, measured and rounded off thousands of times a second to build a digital approximation of it. How faithfully that approximation matches the original comes down to two numbers: how often you measure, and how precisely.
Sampling: measuring at regular instants
Converting an analogue signal into a digital one begins with sampling. Rather than trying to capture every single instant of a continuously-varying signal (which would require infinitely many measurements), the signal's instantaneous value is measured at regular, discrete moments in time. Each individual measurement is called a sample, and the number of samples taken per second is the sampling rate, measured in hertz (samples per second).
Take audio as the running example, since it's the case most often used to illustrate this process. A microphone converts a sound wave into a continuously-varying analogue voltage. To digitise it, that voltage is measured at a fixed sampling rate — for example, standard audio CDs sample at 44 100 Hz, meaning the voltage is measured 44 100 times every second. Between samples, no information about the signal's exact path is recorded at all; the digital representation only ever "knows" the signal's value at each sampled instant.
Quantisation: rounding to a fixed set of levels
Sampling alone isn't enough to produce a digital signal, because each individual sample's value, taken from a continuously-varying analogue signal, could in principle be absolutely any value within a continuous range — exactly the property that makes a signal analogue in the first place. To make each sample truly digital, its value must also be rounded to the nearest of a fixed, finite set of discrete levels. This rounding process is called quantisation.
The number of discrete levels available depends on the number of bits used to store each sample: with $n$ bits per sample, there are $2^n$ distinct quantisation levels to round to (as established in the "Analogue and Digital Signals" lesson). Because the true analogue value of a sample essentially never lands exactly on one of these levels, quantisation introduces a small, unavoidable rounding error, called quantisation error (or quantisation noise) — the difference between the true analogue value and the nearest available digital level.
Once a signal has been sampled and each sample quantised, the result is a sequence of numbers — one per sample, each one of the $2^n$ available levels — and each of these numbers can be written as a binary code using the fixed number of bits per sample. This resulting sequence of binary values is called pulse code modulation (PCM), and it's this stream of binary digits that actually gets stored on a disk, written to memory, or transmitted down a cable or over a radio link.
Sample rate, bits per sample, and quality
Two separate design choices control how faithfully the digital version reproduces the original analogue signal, and both come at the cost of extra data.
- Sampling rate. Increasing the sampling rate means the signal's value is measured more often, so rapid changes in the original signal (high-frequency detail) are captured more faithfully. Too low a sampling rate causes fast variations between samples to be missed entirely, since nothing is recorded about what the signal did between one sample and the next.
- Bits per sample. Increasing the number of bits used for each sample increases the number of available quantisation levels ($2^n$), so each individual sample can more closely match its true analogue value, directly reducing quantisation error.
Both improvements increase fidelity to the original signal, but both also increase the amount of data that has to be stored or transmitted for a given length of signal. This trade-off between quality and data rate is the central design decision in any analogue-to-digital conversion system, and it's frequently tested through calculation questions on the total data rate produced by a given sampling rate and bit depth.
Every analogue-to-digital conversion system is a balancing act between fidelity and data rate. A higher sampling rate and more bits per sample both make the digital version a closer match to the original analogue signal — but both also produce more data per second, requiring more storage space and more transmission bandwidth. Choosing sensible values for these two parameters, matched to what the signal actually needs and what the system can afford to store or transmit, is the whole design problem.
Putting it together
The overall process — sample, then quantise, then encode as binary (PCM) — converts a continuous analogue signal into a discrete digital one that captures the original faithfully enough for its intended purpose, while never being a perfect, lossless copy (quantisation error always remains, however small it's made). What happens once that digital signal has to be stored, transmitted, and eventually recovered — particularly what happens if noise is picked up along the way — is the subject of the next lesson.
Key takeaways
- Sampling measures an analogue signal's value at regular, discrete instants in time; the sampling rate (in Hz) is the number of samples taken per second.
- Quantisation rounds each sample's value to the nearest of a fixed, finite set of discrete levels, determined by the number of bits per sample ($2^n$ levels for $n$ bits).
- Quantisation introduces a small, unavoidable rounding error called quantisation error (or quantisation noise).
- Pulse code modulation (PCM) represents the sampled, quantised signal as a sequence of binary numbers, one per sample.
- Increasing the sampling rate captures faster (higher-frequency) changes in the signal more faithfully, at the cost of more data.
- Increasing the number of bits per sample reduces quantisation error, at the cost of more data per sample.
- Data rate (bits per second) = sampling rate × bits per sample.
- Fidelity to the original analogue signal and data rate always trade off against each other — this is the central design decision in analogue-to-digital conversion.