gorpitx

gorpitx runs rpitx from Go. You hand it a module name and a JSON blob, it checks every field, builds the command line, and runs the rpitx program as a child process with a timeout, a graceful stop and live output. Each rpitx binary has its own argument style, most of them print a usage line and exit when you get one wrong, and all of them leave process handling to you. This library does that part.

It wraps 12 rpitx programs: FM with RDS, a plain carrier, a chirp sweep, Morse, POCSAG pagers, spectrum painting, FT8, SSTV, RTTY, FSK text, audio from a unix socket, and raw I/Q samples. Only one runs at a time, on purpose: the Pi has one transmitter.

Install

go get github.com/psyb0t/gorpitx

The module declares go 1.26 in its go.mod. Transmitting needs a Raspberry Pi with rpitx installed and root. Development and tests do not: set ENV=dev and every module runs a harmless shell loop instead of a transmitter.

Quick look

rpitx := gorpitx.GetInstance()

args, _ := json.Marshal(gorpitx.TUNE{
    Frequency: 434000000, // Hz
})

err := rpitx.Exec(
    context.Background(),
    gorpitx.ModuleNameTUNE,
    args,
    10*time.Second,
)

That runs stdbuf -oL $GORPITX_PATH/tune -f 434000000 for ten seconds, then stops it and returns commonerrors.ErrTimeout. The getting started page has the full program.

Where to go next

You want to Read
Install rpitx and run a first transmission Getting started
Set the rpitx path, dev mode and root Configuration
Run, time out, stop and stream a module Running modules
Look up every field of a module Modules
Tell errors apart with errors.Is Errors
Fix a panic, a refused frequency or a silent script Troubleshooting
See how a call becomes a process Architecture
Build, lint and test the library Development

RF transmission is regulated. Most of these modules put a real signal on the air, and an unfiltered Pi spits harmonics well outside the frequency you asked for. Transmit only where your license allows it.

The Go package docs are on pkg.go.dev, and the source is on GitHub.