Spectrum Lab
New here? Start the course: Radio from scratch → · Quick reference for each step · Build for your own dongle
A software-defined radio receiver, one stage at a time. Load a recording from an RTL-SDR (or use the built-in demo signals), click a signal in the waterfall to tune it, and see what each step does to it.
0Input: complex I/Q samples How & why →
An SDR mixes the antenna signal with its center frequency and samples two channels, I and Q, 90° apart. Because each sample is a complex number, the spectrum covers both sides of the center: −fs/2 to +fs/2.
Live mode: plug in an RTL-SDR (R820T/R820T2 tuner) and press Connect. Our own driver runs in the browser over WebUSB, so there's nothing to install and your samples never leave your computer. Chrome, Edge or Opera. Windows: install the WinUSB driver once with Zadig. Linux: unload the dvb_usb_rtl28xxu kernel module.
1Spectrum & waterfall How it's built →
The line on top is the spectrum right now; below it, each row is one FFT, with time running downward. Brighter means stronger. Click a signal to tune it.
Above: the whole shared window (2.4 MHz), with everyone's slice boxed (yours in orange); click it to go there. Below: your own slice, in detail.
How each of these works, with the math and code: the screen, tuning, filter shift and squelch · voice filter, noise reduction, AGC, limiter, the audio stream and recording.
2Mixer: move the signal to 0 Hz How & why →
Multiplying by e−j2πf·t slides the whole spectrum left by f, so the station you picked now sits at DC.
3Low-pass filter How & why →
A windowed-sinc FIR (orange) keeps ±bandwidth/2 around DC and attenuates everything else by ~50 dB. More taps give a sharper edge but cost more compute.
4Decimate How & why →
Now that nothing outside the passband is left to alias, keep only every M-th sample. The view zooms in: the same station at a much lower sample rate.
5Demodulate How & why →
6Audio How & why →
Filtered again and decimated to about 48 kHz. Then the controls under the waterfall, in order: the squelch gate (it compares the strongest point inside the band with the orange line on the chart, and opens and closes with a short fade so it doesn't click), the voice filter, noise reduction, AGC, and volume through a soft limiter. The audio goes to your speakers as one continuous stream with a small cushion; it plays a hair faster or slower to keep that cushion steady, since the radio's clock and your sound card's never quite agree.
7Decode Morse Learn CW →
The narrow CW channel's strength, sampled about 6,000 times a second, is the keying: on, off, on. A threshold halfway between the noise floor and the recent peak turns it into key-down and key-up times, which are read like a straight key: short is a dit, three times as long a dah, and the gaps split letters and words. The speed adapts to the sender. Tune so the signal sits in the narrow band (the 700 Hz tone is centered).
Last updated