Also known as: libairspy, Airspy library
libairspy is the host-side C library that drives the Airspy R2 and Airspy Mini receivers, streaming their high-dynamic-range IQ over USB.1 It is the driver layer beneath every Airspy application, and its design reflects the Airspy’s positioning as a step up in ADC quality from the RTL-SDR while keeping the same simple callback-based host interface.
How it works
An application calls airspy_open, then configures tuning and rate through
airspy_set_freq, airspy_set_samplerate (the R2 offers 10 and 2.5 MS/s; the Mini
10/6/3 MS/s), and a gain interface that can be driven either as linearized “sensitivity”
values or as the individual LNA, mixer, and VGA stages. The Airspy’s real ADC samples at up
to 20 MS/s and the front end mixes to a low-IF; the R2 then performs an internal
quadrature/decimation step, so the host can request
either real samples or complex IQ. To save USB bandwidth the device sends samples
packed at 12 bits, and libairspy unpacks them and, if asked, converts to float32 or
int16 — meaningful sample-format work done on the host rather
than the wire.
Delivery uses an asynchronous callback: airspy_start_rx registers a function that
libairspy invokes with an airspy_transfer struct — a pointer, a sample count, and the
format — once per filled libusb buffer. As with its sibling libraries this is a
control-inverting callback API: the library owns the
streaming loop and pushes data, and the callback must consume each buffer quickly enough to
avoid dropped samples. airspy_stop_rx and airspy_close tear the session down.
In practice
The library ships with tools such as airspy_rx (record IQ or real samples to a file),
airspy_info, and calibration/SPI-flash utilities. It is wrapped by
gr-osmosdr for GNU Radio and by a SoapyAirspy plugin for
SoapySDR, so most applications use the Airspy through those common
layers rather than calling libairspy directly. A separate libairspyhf library serves the
Airspy HF+ family — different hardware, different API — so the two should not be confused.
Relevance to SDR
libairspy is how software reaches the Airspy’s main selling point: a genuinely higher-quality front end (12-bit ADC, better dynamic range and out-of-band rejection than an 8-bit dongle) at 10 MS/s of usable bandwidth. For an SDR developer it is also a clean example of a host library that does real DSP-adjacent work — bit-unpacking and format conversion — on the CPU before handing samples up, which shapes how much processing the application still has to do.
GopherTrunk works with Airspy captures, and the Airspy is directly relevant to GT’s
documented DSP notes: several trunking captures GT has
analyzed came from an Airspy running at its native 10 MS/s. As a pure-Go application GT does
not link the C libairspy; it ingests IQ over network transports or from recorded files, then
runs a rate-invariant decode chain that normalizes any capture rate to the per-protocol
channel rate. The buffers it receives are exactly what an airspy_start_rx callback would
deliver.
Sources
-
airspyone_host repository — Airspy, the source for libairspy, the RX callback API, packed-sample handling, and the airspy_rx tool. ↩