RbypassmicADCCs[0]–s[1]–s[2]–s[3]–s[4]–1import numpy as np2fc = 1/(2*np.pi*10e3*10e-9)3f = np.array([1000, 7500])4H = 1/np.sqrt(1+(f/fc)**2)10 kΩ10 nFs
01234-2-1012t (ms)v (V)TIMEx(t): 1 kHz + 7.5 kHzx(t): 1 kHz + 7.5 kHzsamples and the wave they showsamples: 1 kHz + 500 Hzx(t) and filtered y(t)x(t) and filtered y(t)x(t) and filtered y(t)filtered samples, wave they showfiltered samples, wave they showfiltered samples, wave they showfs/2above fs/2: aliases01234567800.51f (kHz)peak (V) · gainSPECTRUMtwo tones, 1 V eachfs/2 = 4 kHz7.5 kHz folds to 0.5 kHzalias 1.00 V at 500 Hzbefore the filterfc = 1592 Hz, gain 0.707gains 0.85 and 0.21alias 0.21 V at 500 Hz4th order: 0.99 and 0.002fc 1591.5 Hz
Coloured parts: what the current step is about; everything else rests in whiteBlocks: microphone source, bypass switch, resistor R, capacitor C, converter (ADC), memory cells and a Python code cardPlots: the waves and samples over time, and the spectrum with fs/2, tone bars and the filter's gainThe sample token and the folding whistle bar move in slow motionA 1000 Hz tone and a 7500 Hz whistle are sampled 8000 times a second. Without a filter the whistle aliases to 500 Hz at 1.00 V; through an RC low-pass (fc = 1592 Hz) it lands at 0.21 V. A first-order RC filter is the simplest anti-alias filter. Steeper filters (higher order) or a higher sample rate (oversampling, then a digital filter) give more room between the wanted band and fs/2.

The problem

  1. A microphone picks up a 1 kHz tone we want and a loud 7.5 kHz whistle we do not. Each is a sine wave of 1 V. On the wire they add up: a slow wave covered in fast wiggles.

Aliasing

The anti-alias filter

Better filters

The working

# step 1/10 · mix

x(t) = sin(2π·1000·t) + sin(2π·7500·t)   volts

wanted   1000 Hz, 1 V peak
whistle  7500 Hz, 1 V peak

left plot:  the wave over time
right plot: its spectrum, one bar per
            frequency (bar height = peak V)

Both tones are 1 V (a chosen example); 8000 samples a second is the telephone rate of ITU-T G.711, whose voice band is 300 to 3400 Hz, below the 4 kHz Nyquist frequency. The filtered wave is the steady state, after the switch-on transient (a few RC = 0.1 ms) has died away. Every number is computed from this model. The motion is slowed down a great deal: the real converter takes a sample every 125 µs.