Synthesize a signal, see it in the time domain, and watch the Fast Fourier Transform reveal its frequency content. Tweak sample rate, window, and FFT size to study leakage, picket-fence loss, aliasing, and noise floor. The whole DSP pipeline runs in your browser — no audio is recorded or sent anywhere.
Showing the first N samples of the synthesized signal, with the applied window overlaid in grey. Aliased components (above Nyquist) wrap around — try a 5 kHz sine at fs = 8000.
| # | Bin | Frequency (Hz) | Magnitude | dB |
|---|
The Discrete Fourier Transform decomposes a length-N signal into N complex frequency bins, each one a sinusoid at frequency k · fs / N for k = 0…N−1. Bins above N/2 mirror those below (for real input), so we only plot up to Nyquist (fs / 2). The Cooley–Tukey FFT computes this in O(N log N) instead of O(N²).
Windowing: a rectangular window introduces spectral leakage (energy smears into neighboring bins). Smoother windows trade main-lobe width for lower side-lobes. Flat-top has the lowest amplitude error (good for amplitude measurement) but the widest main lobe.
Coherent gain (CG) scales a sinusoid's apparent amplitude; we divide each bin by CG so a unit-amplitude tone shows ≈ 1.0 in linear mode (≈ 0 dB after the 2/N normalisation). Noise gain (NG) measures how noise variance survives the window.