Sampling & aliasing
When samples tell another story
Sample a sine wave too slowly and a different frequency can fit the same sample points.
Enable JavaScript for interactive controls and synthesized sound. Default model: 700 Hz sampled at 1000 samples/s gives an alias magnitude of 300.0 Hz. Nyquist limit 500 Hz. Playback is a synthesized comparison at the device rate, not a change to your audio hardware.
Default model values
| Component | Frequency | Peak amplitude | Phase |
|---|---|---|---|
| 1 | 300.00 Hz | 0.2263 | 0° |
Listen with a purpose
Try this.
At 1,000 samples/s, compare 300 Hz and 700 Hz. Their samples are compatible with a 300 Hz alias magnitude (with a sign change). Increase the rate to 2,000 samples/s and the 700 Hz tone falls below Nyquist.
What is happening?
Discrete samples cannot distinguish frequencies separated by multiples of the sample rate. Folding into the interval from zero to half the sample rate gives the displayed alias magnitude. The green points are the original sine sampled at exact grid times. The line is the continuous input; the audio is a clean original or alias tone.
The model & its limits
This is a mathematical sampling illustration. It does not reduce the actual device sample rate or emulate an anti-alias filter. The zero-phase sine at exactly Nyquist can produce all-zero samples; reconstruction guarantees require a signal strictly below the limit. A zero-hertz alias is silent.
The interactive model synthesizes sound locally. Audio begins only after you press a listening button. Stop ends every scheduled voice; leaving or hiding the page stops audio. The numerical table remains useful without listening.
Static waveforms and component spectra are calculated from the current model. During playback, the waveform (except calculated swell, envelope and sampling illustrations) and spectrum come from the same browser audio signal. FFT bins have finite resolution; bars in the static view represent exact model components. A/B uses the same master volume; perceptual loudness is not calibrated.
How real instruments use this
Sources & further reading
These sources support the explanations and model assumptions. Recording credits are listed in the listening panels and the source register.
- Web Audio API 1.1 — Editor’s Draft ↗W3C Web Audio Working Group · 2026-11-06 (work in progress)
- Web Audio API best practices ↗MDN contributors / Mozilla · Undated
- Sampling and the frequency domain ↗Chris Donahue / Carnegie Mellon University · 2026
- The Nyquist-Shannon sampling theorem ↗Chris Donahue / Carnegie Mellon University · 2026
- Quantization and decibels ↗Chris Donahue / Carnegie Mellon University · 2026
- Aliasing ↗Chris Donahue / Carnegie Mellon University · 2026
- Sampling in practice ↗Chris Donahue / Carnegie Mellon University · 2026
- Basic waveform shapes ↗Chris Donahue / Carnegie Mellon University · 2026
- Filter types ↗Chris Donahue / Carnegie Mellon University · 2026
- What is a filter? ↗Chris Donahue / Carnegie Mellon University · 2026
- What is a sound spectrum? ↗Joe Wolfe / UNSW Music Acoustics · Undated
- Formant: what is a formant? ↗Joe Wolfe / UNSW Music Acoustics · Undated