So far, the sample rate has been fixed. Real systems often need to change the sample rate as a signal moves through processing stages. CD audio (44.1 kHz) interfaced to consumer DAT (48 kHz) requires resampling. Sigma-delta ADCs sample at megahertz rates internally and decimate to audio rates. Software-defined radio mixers tune across the band by translating-and-decimating. Multirate DSP is the toolkit for these.
6.1 Decimation: reducing sample rate by integer M
To go from to :
- Lowpass filter the signal with cutoff (an anti-aliasing filter, in the digital domain).
- Downsample by : keep every th sample, discard the rest.
Without the lowpass, frequencies above in the input would alias into the new (smaller) Nyquist range, exactly the aliasing failure of Chapter 3 but now in the digital domain. The lowpass enforces the new Nyquist range before the decision to throw samples away.
Notation: a downsampler is drawn as ↓M in block diagrams.
6.2 Interpolation: increasing sample rate by integer L
To go from to :
- Upsample by : insert zeros between every pair of samples.
- Lowpass filter with cutoff (an anti-imaging filter).
The zero-insertion replicates the spectrum at multiples of the original Nyquist (these are called images); the lowpass kills them. What remains is the original spectrum, faithfully represented at the new (higher) sample rate.
A subtle point: after inserting zeros, the average signal energy drops by a factor of . The lowpass should have gain in the passband to compensate.
Notation: an upsampler is drawn as ↑L.
6.3 Rational-rate change L/M
Combine: to go from to where and are integers:
- Upsample by .
- Lowpass-filter at the minimum of and .
- Downsample by .
The two lowpasses combine into one. For 44.1 kHz → 48 kHz, . So upsample by 160, filter, downsample by 147. The intermediate rate of kHz is huge but transient; we never store at that rate.
6.4 Polyphase decomposition: making it fast
Naive implementation of an upsample-by-, filter, downsample-by- chain wastes most of its work. After upsampling, of every samples is zero. Multiplying zero by a coefficient is wasted. After filtering, all but every th sample is thrown away. So we are computing a lot of outputs we never use.
Polyphase decomposition rearranges the math to do only the needed work.
Decompose the FIR into subfilters (the "polyphase components"):
Each subfilter is subsampled by , with a different phase offset. Then the chain "upsample by , filter, downsample by " can be reorganized so that the input is filtered through one of the polyphase subfilters at a time, depending on the output sample index, with no zero-multiplies and no discarded outputs. The arithmetic count drops by a factor of for upsampling-only, and by for the combined case.
Polyphase decomposition is the implementation method in modern multirate DSP. Every audio resampler, every sigma-delta decimation filter, every SDR digital downconverter uses polyphase under the hood.
6.5 Half-band filters: a special case
A half-band lowpass has cutoff at exactly and a special property: half its coefficients are zero (every other one, except the center tap). So a length- half-band FIR really has only nonzero taps. Half the multiplies.
Used for any factor-of-2 sample-rate change: upsample-by-2 with a half-band, downsample-by-2 with a half-band. Iterating: upsample-by-8 = three cascaded upsample-by-2, each with a half-band filter. Very efficient. Used pervasively in sigma-delta ADC decimation and in oversampling DACs.
6.6 Applications
- Oversampling sigma-delta ADCs. A sigma-delta modulator samples at, say, the desired output rate (so 64 fs). It produces a 1-bit (or low-bit) stream that is heavily oversampled but quantization-noisy. A multirate digital decimation filter (typically a series of half-band filters) downsamples to the target rate while filtering out the high-frequency quantization noise. This is how audio ADCs and most modern sensor ADCs work, and is a beautiful piece of engineering: the ADC's analog circuitry can be simple (a 1-bit comparator) because all the precision is recovered in the digital decimation.
- Audio sample-rate conversion. 44.1 → 48 (movie post-production), 48 → 44.1 (mastering for CD), 96 → 48 (downmixing studio takes for distribution). All polyphase rational-rate.
- Software-defined radio. Tune to a channel by mixing it down to baseband, then decimate to the channel bandwidth. The decimation chain is typically a CIC (cascaded integrator-comb) filter for big rate reductions, followed by polyphase FIR for fine shaping.
- Sub-band coding. MP3, AAC, MPEG-4: split the signal into frequency bands using a polyphase filter bank, encode each band with bit allocation determined by a psychoacoustic model. Multirate filter banks are the structural foundation of modern audio codecs.
- Image pyramids. Computer vision and graphics use Gaussian and Laplacian pyramids: chain of factor-of-2 downsampled (and corresponding upsampled) versions of an image. Used for multiscale analysis and for the blur kernels in classical image processing.
The implementation in scipy is one line:
from scipy import signal
y = signal.resample_poly(x, up=160, down=147)scipy.signal builds the polyphase FIR internally with a Kaiser-window-based design.