Digital Sound Sampling: How Computers Capture Music
Introduction
Every piece of digital music — from a Spotify stream to a Hollywood film score — began its life as a continuous analog wave and was transformed into a series of discrete numbers through digital sampling. This conversion process, governed by the Nyquist-Shannon sampling theorem, is one of the most important achievements in modern signal processing. Understanding how sampling works reveals both the remarkable capabilities and the fundamental limitations of digital audio.
From Analog to Digital
An analog sound wave is a continuous function of time — at every instant, the air pressure has a precise value. A digital representation stores this wave as a sequence of discrete measurements taken at regular intervals. The device that performs this conversion is the analog-to-digital converter (ADC).
The ADC samples the input waveform at a fixed rate, called the sampling frequency, and assigns each sample a numerical value. Two parameters determine the quality of the digital representation:
- Sampling rate ($f_s$): How many measurements are taken per second (measured in Hz or kHz)
- Bit depth ($b$): How many discrete amplitude levels are available to represent each sample
The Nyquist-Shannon Sampling Theorem
The Nyquist-Shannon theorem is the cornerstone of digital audio. It states that to perfectly reconstruct a continuous signal from its samples, the sampling rate must be at least twice the highest frequency present in the signal:
$$f_s \geq 2f_{max}$$
The highest frequency that can be represented at a given sampling rate is called the Nyquist frequency:
$$f_{Nyquist} = \frac{f_s}{2}$$
For CD-quality audio, the sampling rate is 44,100 Hz, which allows accurate reproduction of frequencies up to 22,050 Hz — just above the upper limit of human hearing (approximately 20 kHz). This is why 44.1 kHz became the standard: it captures the entire audible range with a small safety margin.
If a signal contains frequencies above the Nyquist frequency, these frequencies are aliased — they appear in the digital signal as false lower-frequency components that were not present in the original. To prevent aliasing, an anti-aliasing filter (a low-pass filter) is applied before sampling to remove frequencies above the Nyquist limit.
Bit Depth and Quantization
Each sample must be assigned a numerical value from a finite set of discrete levels. The number of available levels is $2^b$, where $b$ is the bit depth. Common bit depths in professional audio are:
| Bit Depth | Levels | Dynamic Range |
|---|---|---|
| 8-bit | 256 | ~48 dB |
| 16-bit | 65,536 | ~96 dB |
| 24-bit | 16,777,216 | ~144 dB |
| 32-bit float | 4,294,967,296 | ~1,920 dB |
The difference between the actual analog value and the nearest discrete level is called quantization error. This error introduces a type of noise called quantization noise, which is most noticeable at low signal levels. Higher bit depth reduces quantization noise and increases dynamic range.
The dynamic range of a digital system is approximately:
$$DR \approx 6.02 \cdot b + 1.76 \text{ dB}$$
A 16-bit system provides about 96 dB of dynamic range, which is sufficient for most musical applications. A 24-bit system provides about 144 dB, which exceeds the dynamic range of any acoustic environment and virtually eliminates quantization noise.
Sampling Rate Selection
The choice of sampling rate involves tradeoffs between audio quality and data rate:
- 44.1 kHz (CD standard): Captures up to 22.05 kHz, sufficient for most music
- 48 kHz (standard for video/film): Slightly higher Nyquist frequency
- 96 kHz (high-resolution audio): Captures up to 48 kHz, useful for processing
- 192 kHz (ultra high-resolution): Captures up to 96 kHz, used in professional recording
Higher sampling rates capture frequencies beyond human hearing, but this information can be useful during audio processing. When you apply effects like compression, equalization, or pitch shifting, frequencies above 20 kHz can fold down into the audible range. Higher sampling rates prevent this aliasing during processing.
D/A Conversion and Playback
To convert digital samples back to analog sound, a digital-to-analog converter (DAC) reconstructs a continuous waveform from the stored values. The DAC outputs a staircase-like signal that must be smoothed by a reconstruction filter (low-pass filter) to remove the high-frequency components introduced by the discrete sampling process.
Modern DACs use techniques like oversampling and noise shaping to achieve very high quality reconstruction. Oversampling increases the effective resolution by computing intermediate values between the original samples, while noise shaping pushes quantization noise into frequency ranges where it is less audible.
The Compact Disc Format
The CD format, introduced in 1982, established 44.1 kHz / 16-bit as the consumer audio standard. This choice was influenced by the video recording technology available at the time — early digital audio was recorded on video tape recorders, and the sampling rate had to be compatible with NTSC and PAL video standards.
The Red Book CD standard specifies 44,100 samples per second, 16 bits per sample, and two channels (stereo). This yields a data rate of approximately 1.41 Mbps and allows about 74 minutes of audio on a standard disc.
Summary
Digital sampling is the bridge between the continuous world of sound and the discrete world of computation. The Nyquist theorem guarantees perfect reconstruction when sampling is done correctly, while bit depth determines the precision of each measurement. Together, these parameters define the quality and limitations of digital audio. Understanding these principles is essential for anyone working with recording, mixing, or sound design in the digital domain.