Radio → ring buffer → modems and decoders
The path every received sample takes inside SPEEDBIRD, what decoders and modems each do with it, and why putting the modem directly on the ring is better than wiring programs together with sound cards.
From radio to modem#
Every signal SPEEDBIRD hears follows the same path: radio → ring buffer → decoders and modems. The radio is read once. Its samples go into a single shared-memory ring buffer, and every decoder and every modem reads that ring at the same time, each in its own process. Nothing has to copy audio from one program to the next, and nothing waits for anything else.
Radio in. An Icom over LAN sends its 48 kHz IF with the dial at +12 kHz. An SDR, through SoapySDR, is mixed, decimated and filtered into exactly the same 48 kHz IF. A radio on plain rig audio works too. Whatever the hardware, the rest of the chain sees the same kind of signal, about 24 kHz wide instead of the 3 kHz a normal audio output gives.
Ring buffer. One process, the radio's reader, writes the samples into a shared-memory ring, with a header that records the sample rate, the centre frequency and a running count of every sample written. That is the only writer. The writer never waits for anyone.
Readers. Any number of processes attach to the ring by name. Each keeps its own read position, so the waterfall, the FT8 decoder and the modem can be at slightly different points in the stream without disturbing each other. A reader that falls more than a full ring behind is moved forward and told how many samples it missed. If a block is overwritten while it is being copied, that block is detected and thrown away. A slow reader only hurts itself.
Decoders and modems. Each reader cuts out what it needs. A decoder mixes its dial frequency to zero, filters, demodulates (USB, LSB or FM) and resamples to its own rate. A modem turns the ring into the 48 kHz USB audio it expects, and the ring's steady flow paces the modem's clock as a sound card would. It never runs more than a quarter of a second behind the live signal.
Out. Decoders publish what they hear on a ZeroMQ message bus: one message per decode, plus a heartbeat every 2 s with samples read and samples dropped. Modems hand received data to a host program over their TNC port, and every transmission goes back to the radio through the TX arbiter.
Decoders and modems#
Both read the same ring, but they do different jobs:
| Decoder | Modem | |
|---|---|---|
| Direction | Receive only | Receive and transmit |
| Job | Turns a signal into text, frames or pictures | Runs a two-way link: connect, acknowledge, resend what was lost, change speed as conditions change |
| Examples | FT8 / FT4, AX.25 / APRS 300 and 1200 Bd, PSK31, CW, SSTV, the VARA monitor | SBP, VARA HF, ARDOP, Mercury, AX.25 connected mode, PACTOR-I |
| Where results go | The message bus, the decode log, the waterfall and map | A byte stream to a host program over a VARA-style TNC port |
| Transmitter | Never touches it | Only through the TX arbiter |
| How many per radio | As many as you like, one process per decoder and frequency | One connected-mode modem port per radio, alongside all the decoders |
A decoder is a listener: if it misses a frame, nothing is lost but that one decode. A modem is half of a conversation, so it has to keep up with the other station, answer on time and get every byte across.
Why the ring-fed modem is better#
Most HF data stations are built as a chain of separate programs joined by sound cards: the radio's USB audio goes into the operating system's mixer, often through a virtual audio cable, into one modem program that takes the device for itself and keys PTT on its own. SPEEDBIRD's modems sit directly on the ring buffer instead.
| Typical sound-card modem | SPEEDBIRD modem on the ring | |
|---|---|---|
| Getting audio | Sound card, OS mixer, often a virtual audio cable or loopback device | Reads the radio's samples straight from shared memory |
| Sharing the receiver | Usually one program owns the device; anything else needs another virtual cable | The modem, waterfall, every decoder and the VARA monitor all hear the same samples at once |
| Bandwidth seen | About 3 kHz of audio | The radio's whole IF or IQ (about ±12 kHz), so one slice covers FT8 and the SBP calling channel |
| Several modems | Each one competes for loopback channels | ARDOP and VARA connect to SPEEDBIRD through a socket instead of ALSA, so several radios can run ARDOP at the same time |
| When something stalls | A stuck program can starve the others or drop audio for everyone | Separate processes with their own read positions: a slow decoder only loses its own samples |
| Turnaround | Mixer and cable latency on every over | Each modem stays within 250 ms of the live signal. Repeat bursts on the same frequency, mode and power skip the radio set-up commands to fit VARA's ~100 ms turnaround |
| Keying the radio | Each program keys PTT or VOX itself | One TX arbiter for everything: callsign, TX enable, data mode, power policy, timeout, watchdog unkey and a station log |
| Settings | Different screens and ini files for each modem | One framework: speed ladders, the web UI, Pat profiles and the TNC commands are the same for every protocol |
The result is fewer things to wire up, nothing to go out of sync between programs, and one place that decides whether the radio may transmit.