Modem Lab
2026 · Rust · WebAssembly · Web Audio · How this site works
Before Wi-Fi and packet networks, pictures and programs travelled through anything that could carry a voice: shortwave radio, a phone line, a cassette tape. The Modem Lab puts two of those modulations in the browser, on both ends of the wire. Turn a picture into real Slow-Scan Television (SSTV) tones, or turn text and links into Bell-202 FSK cassette audio, push them through static, tape wobble and clock drift, and watch the receiver paint the scanlines or recover the bytes live. Open the lab on a phone, press listen, and press transmit on your laptop to beam a picture across the desk through the air. Nothing is uploaded: all encoding, filtering and decoding stay in your browser.
Slow-Scan Television: a picture as one moving pitch
A television channel needs megahertz of bandwidth because it sends thirty whole frames a second. Amateur radio gets three kilohertz of voice audio instead, so SSTV makes the obvious trade: slow the frame down from a thirtieth of a second to somewhere between eight seconds and two minutes, and encode brightness as frequency rather than amplitude.
Every tone sits inside the voice passband, which is why SSTV survives a cheap laptop speaker, a phone microphone, or a handheld radio like the 70 cm transceiver on the JM-01:
- 1200 Hz is the horizontal sync pulse that marks the start of each scanline.
- 1500 Hz is black, 2300 Hz is white, and every shade between sits linearly across those 800 hertz.
- 1900 Hz is the calibration leader that wakes the receiver up.
Before the first scanline, every transmission sends a 910-millisecond VIS (Vertical Interval Signaling) header: two 300 ms bursts of 1900 Hz with a 10 ms 1200 Hz break between them, a 30 ms start bit at 1200 Hz, seven data bits LSB-first (1100 Hz for 1, 1300 Hz for 0), an even parity bit, and a stop bit. That code tells the receiver which mode is arriving so it can switch resolution and timing automatically:
| Mode | VIS | Size | Colour | Duration | Notes |
|---|---|---|---|---|---|
| Robot 8 BW | 02 | 160×120 | Monochrome / amber | ~9 s | Fast enough to beam a photo across a room on camera. |
| Robot 36 | 08 | 320×240 | YCrCb 4:2:0 | 37 s | Full luminance every line; R−Y and B−Y alternate on even and odd lines, marked by a 1500 Hz or 2300 Hz separator. |
| Martin M2 | 40 | 320×256 | RGB (G · B · R) | 59 s | Sequential green, blue and red scans per line, half the scan time of M1. |
| Martin M1 | 44 | 320×256 | RGB (G · B · R) | 115 s | The classic European amateur-radio standard; you literally watch G, B and R paint into colour. |
| PD120 | 95 | 640×496 | YCrCb (paired) | 127 s | Sends two rows per 508.5 ms sync (Y0, shared R−Y, shared B−Y, Y1) — the mode broadcast by the International Space Station. |
Because the timings match the Dayton specifications, a WAV exported here decodes in third-party ham apps, and an ISS PD120 recording dropped onto the monitor decodes right on the page.
Tape & packet: Bell-202 FSK with Reed-Solomon
Switch to tape and the lab becomes an acoustic data modem: 1200 Hz for a 1 (mark) and 2200 Hz for a 0 (space), the Bell-202 tones behind 1200-baud amateur packet radio and APRS, at either 300 baud (rugged across a noisy room) or 1200 baud (crisp four-times-faster bursts).
A raw bit stream over speakers breaks the moment a long run of spaces removes clock edges or a single click flips a bit. Each packet therefore carries four layers:
- Preamble & sync word. 320 ms of alternating
101010…(0x55) lets the bit-clock PLL settle, followed by a 24-bit sync word (0xD3 0x91 0xA5) accepted within two bit flips. - RS(8, 4) header. Four bytes of framing (magic, payload length, parity level) protected by four parity bytes, fixing up to two corrupted header bytes.
- Reed-Solomon blocks over GF(256). The UTF-8 payload plus a CRC-16 is split into codewords with
0,16, or32parity bytes (fixing up to 0, 8, or 16 arbitrary byte errors per block via Berlekamp–Massey, Chien search and Forney's formula). Turn ECC off in the panel and crank static or dropouts to see raw garbled characters; switch to rs-32 and watch the exact same storm land withCRC OK. - Additive whitening. XORing the encoded bytes with a fixed xorshift stream guarantees plenty of
0 ↔ 1transitions for the clock recovery loop even if you send a hundred spaces in a row.
If the received message contains a link — for example a song copied from the Chiptune Lab — the terminal lights up a button to open it directly.
Beaming over the air
Open /islands/modem/ on a phone, tap listen, and press transmit on your laptop. You don't need to pick the same mode on the receiving device: the receiver runs its SSTV VIS detector and both the 300- and 1200-baud FSK correlators at the same time, so whichever signal arrives locks and switches the monitor automatically.
One browser detail makes or breaks real acoustic transfers: by default, getUserMedia({ audio: true }) turns on voice noise suppression, echo cancellation, and automatic gain control. Noise suppression treats steady FM tones as background hum and erases them. Turning all three off in the microphone request is the difference between mush and a sharp picture from across the desk.
Channel impairments and sync
Even on one machine, the channel sliders let you break the wire while a transmission is running:
- static adds band-shaped Gaussian noise — snow on SSTV scanlines, flipped symbols on FSK.
- wow bends the signal through a sinusoidally modulated fractional delay line (slow 0.55 Hz tape wow plus 5.8 Hz flutter).
- drift resamples the audio by ±2000 parts per million, mimicking two soundcards whose quartz crystals disagree.
- radio adds a 420–2750 Hz bandpass, soft clipping, mild multipath echo and slow ionospheric QSB fading.
- dropouts punches random short mutes and bursts of crackle into the stream.
Uncheck auto horizontal sync while drift or wow is turned up to see what an unsynchronised slow-scan receiver does: the frame slants diagonally or snakes down the screen. Turn it back on and the receiver hunts for every 1200 Hz → 1500 Hz horizontal sync edge, pulling each row straight and coasting on a flywheel when static buries a pulse.
How it's built
The engine is a zero-dependency Rust crate compiled to an 80 KB WebAssembly module with no bindings, like the other labs'. Everything runs on the same streaming pipeline whether the samples come from loopback, a dropped WAV, or the microphone's AudioWorklet:
- FM discrimination shifts the incoming signal down to complex baseband around 1750 Hz, filters
IandQthrough a linear-phase Blackman-windowed sinc FIR, and reads instantaneous frequency fromatan2(Im(z[n] · conj(z[n-1])), Re(…)). Because phase differences cancel amplitude, the decoder doesn't care whether your phone sits ten centimetres or two metres from the speaker. - FSK demodulation runs sliding one-bit matched-filter DFTs at 1200 Hz and 2200 Hz (
O(1)per sample via ring buffers) feeding a zero-crossing bit-clock PLL — non-coherent by design, so room phase distortion can't invert the bits. - The waterfall runs a 2048-point radix-2 Hann FFT every 20 ms across 800–2600 Hz, drawn on the same amber-purple ramp as the Spectrogram Lab.
Exporting a WAV writes the exact channel-impaired mono signal: drop it into the Spectrogram Lab to see the horizontal sync pulses, VIS bits, and scanline bands up close, or pass a picture from the Dither Lab straight into Robot 8.
Back to Labs · see sound as a picture in the Spectrogram Lab · write a tune to beam in the Chiptune Lab · see how this site works.