Sampling, the Nyquist limit and aliasing
A sampler records a value every 1/fs seconds and throws away everything between. That operation is lossy in a very specific way: any frequency above fs/2 is indistinguishable from one below it, because both can produce exactly the same sample sequence.
f_alias = | f − k·fs | for the nearest integer k, valid range 0 ≤ f_alias ≤ fs/2
The arithmetic of folding
At fs = 8 000 Hz, the Nyquist frequency is 4 000 Hz. A 7 000 Hz sine sampled at that rate gives the same samples as a 1 000 Hz sine, because 7 000 − 8 000 = −1 000 and the two differ only by a sign that a sine cannot reveal. A 3 000 Hz tone is fine; a 5 000 Hz tone folds to 3 000 Hz and collides with it.
| Input frequency | Alias at fs = 8 kHz | Audible result |
|---|---|---|
| 1 000 Hz | 1 000 Hz | unchanged |
| 3 000 Hz | 3 000 Hz | unchanged |
| 5 000 Hz | 3 000 Hz | collides with the tone above |
| 7 000 Hz | 1 000 Hz | collides with the first |
| 9 000 Hz | 1 000 Hz | same alias as 7 kHz |
Why harmonics alias first
A square wave at 1 kHz has harmonics at 3, 5, 7, 9 kHz and beyond. Sample it at 8 kHz and the 5 kHz harmonic appears at 3 kHz, the 7 kHz at 1 kHz, the 9 kHz at 1 kHz again. The result is not a duller square; it is a different waveform with inharmonic content, which is why aliasing sounds metallic rather than simply muffled.
This is the reason a synthesiser built from naive waveforms needs either oversampling or band-limited tables. WaveLab's synthesiser avoids the problem by building its sound from twelve explicit harmonics: at f₀ = 880 Hz the highest is 10.56 kHz, comfortably below Nyquist at 48 kHz. Raise f₀ far enough and the same rule would bite here too.
Spotting an alias on the display
An aliased peak moves the wrong way. Sweep the true frequency upwards past fs/2 and the displayed peak starts moving down from fs/2, mirroring the sweep. A real tone always moves up with the input. If you can change the sample rate and the apparent frequency jumps, it is an alias.
In the analyser studio fs is fixed at 48 kHz and the input is synthesised below Nyquist, so no alias appears. The values are there to show what the limit means, not to demonstrate a fault.
Anti-alias filtering
Real converters put a low-pass filter before the sampler and remove everything above fs/2. Its transition band costs either sample rate or bandwidth: a filter that is flat to 20 kHz and −100 dB at 24 kHz needs a gentle slope, which is why 48 kHz became the practical minimum for 20 kHz audio rather than the theoretical 40 kHz.
Questions
Is 44.1 kHz enough for 20 kHz audio?
For sampling, yes with a filter. 44.1 kHz leaves 2.05 kHz of transition band above 20 kHz, which is tight but workable. The extra rate at 48 kHz is mostly about that filter and about video clock relationships.
Does a higher sample rate improve the sound of a synthesised tone?
It changes where aliasing starts, not the tone below Nyquist. A band-limited synthesiser at 44.1 kHz and one at 96 kHz produce nearly identical audio under 20 kHz; the difference is headroom for non-linear processing.
In the analyser, set both tones to 3 kHz and 5 kHz with N = 2048 at 48 kHz — the 5 kHz tone is real here, and the spectrum shows why fold-back would be ambiguous.
Open the studioWritten from standard Fourier analysis, digital signal processing and acoustics; the worked numbers can be reproduced in the studio linked above.
Back to the guides