SPEEDBIRD

Modular modem: waveform families, link protocols, ladders#

speedbird.modem splits a data modem into three pluggable layers so new modes can be added without touching the SBP or VARA code:

layer what it is built in
Waveform family (Waveform) a table of speed levels + modulate / demodulate sbp, vara-hf-500, vara-hf-2300, vara-hf-2750
Link protocol (LinkProtocol → LinkSession) connect, ARQ, level adaptation over one or more families sbp, vara-hf
Ladder (Ladder) a named, assignable set of levels for one protocol defaults per protocol + modem.ladders in the config

Every level has a global key family:name, e.g. sbp:QPSK1/2, vara-hf-2300:L7.

speedbird modem levels       # every registered level (key, kind, bps, min SNR, bandwidth)
speedbird modem protocols    # protocols, their families and default ladder
speedbird modem ladders -c /etc/speedbird/speedbird.yaml
GET /api/modem               # the same as JSON for the web UI

Assigning ladders#

modem:
  ladders:
    sbp-ofdm-only:
      protocol: sbp
      levels: [R4, R2, BPSK1/2, QPSK1/2, 8PSK2/3]   # bare names take the protocol's family
    sbp-weak:
      protocol: sbp
      levels: [sbp:FST4-60, sbp:FT8, sbp:FT4, sbp:R4]
      options: {start_protocol: ft8}
    vara-2300:
      protocol: vara-hf
      bandwidth: 2300            # all levels L1-L16

tnc:
  - {radio: ic7300, cmd_port: 8300, kind: modem, protocol: vara-hf, ladder: vara-2300}
  - {radio: ic7610, cmd_port: 8310, kind: modem, protocol: sbp, ladder: sbp-ofdm-only}

min, max and fixed cut a ladder; adapt: false stops level changes. A host program can switch ladders while idle with the TNC command LADDER <name> (LADDER alone queries it).

Protocols whose level order is fixed by the air interface (fixed_order = True: SBP's level codes, VARA's record numbers) keep their own order: a ladder can only enable or disable levels and cut the range. For VARA HF the level sequence, ACK codes and adaptation rules are VARA's, so the ladder only limits what we offer; everything on the air stays bit-exact with VARA (see "VARA HF" below).

Adding a waveform family#

Minimal example: docs/examples/mfsk_plugin.py (plain MFSK + CRC, two levels; the test suite loads it as a third-party plugin).

from speedbird.modem import LevelInfo, RxBurst, Waveform, register_waveform

@register_waveform("myfam")
class MyWaveform(Waveform):
    sample_rate = 48_000

    def levels(self):                       # most robust first
        return [LevelInfo("myfam", "SLOW", code=0, kind="fsk", bps=50, min_snr_db=-5,
                          bandwidth_hz=500, payload_bytes=32, rank=0)]

    def modulate(self, level, frames):      # -> float32 audio at sample_rate
        ...

    def demodulate(self, level, audio, nframes=1, start=None):   # -> RxBurst
        ...

Ship it in your own package and expose the module through the speedbird.plugins entry point:

[project.entry-points."speedbird.plugins"]
myfam = "my_package.myfam"

or drop it into src/speedbird/modem/families/ (every module there is imported at start-up; names starting with _ are skipped).

Implement LinkProtocol (families, default_ladder(), session()) and LinkSession (connect, send, disconnect, feed_rx, tick, status), and register it with @register_protocol("name"). Sessions are pure, event-driven state machines with an injectable clock. They report through emit(kind, **info). These kinds are used: connected, disconnected, failed, received (data), sent, level (from/to level keys), heard, snr. The TNC host interface (tnc: kind: modem) and the web UI work for any protocol that follows that.

transmit(audio, rate) may block for the burst (radio) or return at hand-off (simulator); schedule your "burst finished" from now() plus the burst length.

Test it with the two-station simulator:

from speedbird.modem.sim import PairSim
sim = PairSim("myproto", "W1AW", "N0CALL", snr_db=10)
sim.a.connect("N0CALL"); sim.a.send(b"hello")
assert sim.run(lambda: sim.received(sim.b) == b"hello", max_s=120)

VARA HF#

VARA HF comes from xara-python (packages xara.phy / xara.arq), a separate MIT project: a Python port (complete rewrite in Python) of xara (MIT, © 2026 x0rro; licence in LICENSES/xara-MIT.txt), a modem black-box matched to VARA HF 4.9.0. It contains no code or data from VARA.exe. Compatibility is checked against xara's own conformance vectors (reference/xara/vectors) in the xara-python test suite. All levels (500 Hz L1-L13, 2300 Hz L1-L16, 2750 Hz L1-L17) are ordinary levels here; the vara-hf link protocol is a thin adapter over xara-python's own Station, and on a radio kind: modem, protocol: vara-hf runs it in a worker process. On the air, a link goes above L4 only when the calling station sets the "registered" flag in its connect header (the answering station adopts it). Between SPEEDBIRD/xara stations that flag is just the high-speed switch. Toward a real VARA station it tells that station's VARA software you hold a VARA key, so the station setting modem.vara_registered (TNC: VARAREGISTERED ON|OFF) should reflect that truthfully.