Audio to Digital Conversion

Author
Affiliation

Cam

Anauseam

Published

2026-03-31

Because the workings of a real world ADC come with magnitudes more nuance than an idealized model, we will only focus on idealities and what occurs mathematically.

The digitization process is fundamentally a two-step operation: sampling, which converts a continuous-time signal into discrete-time instances (slicing time), and quantization, which maps continuous amplitudes to a finite set of values (slicing amplitude).

Sampling

Sampling is the process of converting a continuous-time signal x(t) into a discrete-time sequence x[n]. Mathematically, this is modeled as the multiplication of the continuous input signal x(t) with a periodic train of Dirac delta functions (the “Dirac Comb” or “Impulse Train”), denoted as s(t).

Given a sampling period T_s = \frac{1}{f_s}, the sampling function (Impulse Train) is defined as:

s(t) = \sum_{n=-\infty}^{\infty} \delta(t - nT_s)

The sampled signal, x_s(t), is the product of the input and the sampling function:

x_s(t) = x(t) \cdot s(t) = x(t) \sum_{n=-\infty}^{\infty} \delta(t - nT_s)

Using the sifting property of the Dirac delta function, this results in a sequence of weighted impulses:

x_s(t) = \sum_{n=-\infty}^{\infty} x(nT_s) \delta(t - nT_s)

Frequency Domain Implications

To understand the implications for frequency analysis (crucial for pitch detection), we must view this in the frequency domain. Multiplication in the time domain corresponds to convolution in the frequency domain1. If X(f) is the Fourier Transform of x(t) and S(f) is the transform of the impulse train, we know that S(f) is also an impulse train in the frequency domain spaced by f_s.

1 The operation of convolution and the fact that convolution is equivalent to multiplication in the frequency domain are cornerstone ideas in the field of signal processing.

Given the fourier transform of the impulse train \mathcal{F}\{s(t)\} = f_s \sum_{k=-\infty}^{\infty} \delta(f - kf_s), the spectrum of the sampled signal is: X_s(f) = X(f) * S(f) = X(f) * \left[ f_s \sum_{k=-\infty}^{\infty} \delta(f - kf_s) \right]

This results in the spectral replication of the original signal’s spectrum at integer multiples of the sampling rate:

X_s(f) = f_s \sum_{k=-\infty}^{\infty} X(f - kf_s)

NoteReal World Deviation

Ideally, sampling is instantaneous. In reality, an “aperture effect” occurs because the capacitor in a Sample-and-Hold circuit takes a finite amount of time to charge. This results in the multiplication of the spectrum by a \text{sinc} function, causing a slight high-frequency roll-off (droop) that must be compensated for. Additionally, clock jitter introduces phase noise, raising the noise floor.

Quantization

While sampling discretizes time, quantization discretizes the signal’s amplitude by mapping the continuous amplitude x[n] to a finite set of levels. It is a non-linear, non-invertible process that maps a continuous amplitude x[n] to a discrete set of levels M.

Assuming a uniform quantizer with a Full Scale Range (FSR) of V_{pp} (peak-to-peak voltage) and a bit-depth of B, the number of discrete levels is M = 2^B. The quantization step size (or resolution), denoted as \Delta, is:

\Delta = \frac{V_{pp}}{2^B}

The quantized signal x_q[n] can be modeled as the original signal plus an additive noise term, e[n]:

x_q[n] = Q(x[n]) = x[n] + e[n]

where e[n] is the quantization error. In an ideal model, we assume e[n] is modeled as a random variable with a uniform Probability Density Function (PDF) over the interval [-\frac{\Delta}{2}, \frac{\Delta}{2}].

Signal-to-Quantization-Noise Ratio (SQNR)

For a piano tuning application, the SQNR determines the “purity” of the captured tone and the system’s ability to analyze low-level harmonics during the decay phase.

The power of the quantization noise (P_n), assuming a uniform distribution, is the variance of the error:

P_n = \sigma_e^2 = \int_{-\Delta/2}^{\Delta/2} \frac{1}{\Delta} e^2 \, de = \frac{\Delta^2}{12}

For a sinusoidal input with amplitude A = \frac{V_{pp}}{2}, the signal power P_s is a function of the bit depth B and the quantization step size \Delta.

P_s = \frac{\Delta^2 2^{2B}}{8}

Taking the ratio of the signal power to the quantization noise power, the theoretical maximum SQNR in decibels is derived as:

\text{SQNR}_{dB} = 10 \log_{10}\left(\frac{P_s}{P_n}\right) \approx 6.02B + 1.76 \text{ dB}

16-bit vs. 24-bit Sampling Depth

In the context of piano analysis, the choice of bit depth B drastically alters the noise floor.

16-bit Audio: At B=16, the theoretical dynamic range is: 6.02(16) + 1.76 \approx 98 \text{ dB} This is the CD quality standard. For playback 16-bit is sufficient. In our case, 16-bit is generally sufficient for the fundamental frequency. However, quiet harmonics in the decay phase may approach the quantization noise floor.

24-bit Audio: At B=24, the dynamic range increases significantly: 6.02(24) + 1.76 \approx 146 \text{ dB} 24-bit sampling provides a massive amount of headroom. It allows the input gain to be set lower (avoiding clipping on the piano’s percussive attack) while still maintaining a noise floor low enough to analyze the signal’s frequency content clearly as it decays.

NoteRevision

Add graphs to show the jump in the SQNR as the bit depth increases. Include a linear and logarithmic plot.

NoteReal World Deviation

Real ADCs rarely achieve theoretical SQNR due to thermal noise and non-linearities (Integral Non-Linearity / Differential Non-Linearity). The “Effective Number of Bits” (ENOB) is usually 1 to 2 bits lower than the nominal bit depth.

Anti-aliasing

Anti-aliasing is the physical prerequisite to valid Discretization. As shown in the Discretization section, the sampled spectrum X_s(f) contains copies of X(f) at multiples of f_s.

If the input signal x(t) is not band-limited, or if the bandwidth B_W exceeds the Nyquist limit (f_s/2), the spectral copies will overlap. This overlap adds constructive and destructive interference to the baseband spectrum, a phenomenon known as Aliasing.

Mathematically, to prevent aliasing (where high frequencies masquerade as low frequencies), the Nyquist-Shannon Sampling Theorem demands:

f_s > 2 \cdot B_W

In a piano tuner, if a harmonic exists at 25 \text{ kHz} and we sample at 44.1 \text{ kHz}, the alias appears at:

|25000 - 44100| = 19,100 \text{ Hz}

To ensure this condition, an analog Low-Pass Filter (LPF)—the Anti-Aliasing Filter—must be applied before the ADC.

The ideal filter is a “brick-wall” filter:

H(f) = \begin{cases} 1, & |f| < f_s/2 \\ 0, & \text{otherwise} \end{cases}

NoteReal World Deviation

An ideal “brick-wall” filter with a vertical cutoff at f_s/2 is physically impossible (it requires infinite latency). Real ADCs use oversampling architectures (Sigma-Delta modulation). They sample at very high rates (e.g., 64 \times f_s) with a gentle analog filter, then use a sharp digital filter to downsample. This simplifies the analog electronics while maintaining phase linearity in the passband.