v3.12.0 — Spectrum bin decoding and SpectrumStream
What's New
Spectrum bin vector decoding
decode_status_packet() now decodes BIN_DATA (float32, SPECT_DEMOD) and BIN_BYTE_DATA (uint8, SPECT2_DEMOD) TLV vectors from radiod status packets. New fields on SpectrumStatus:
bin_data— float32 power values per FFT binbin_byte_data— uint8 quantised log-power valuesbin_power_dbproperty — dB values regardless of source format
SpectrumStream
New class for receiving real-time FFT spectrum data from radiod. Spectrum data flows over the status multicast channel (port 5006) as TLV vectors, not over RTP. SpectrumStream handles:
- Channel creation (
SPECT2_DEMODby default) - Periodic polling to keep the channel alive
- SSRC filtering and bin vector decoding
- Callback delivery with ready-to-use numpy arrays
from ka9q import RadiodControl, SpectrumStream
def on_spectrum(status):
db = status.spectrum.bin_power_db
print(f"{len(db)} bins, peak {db.max():.1f} dB")
with RadiodControl("radiod.local") as ctl:
with SpectrumStream(
control=ctl,
frequency_hz=14.1e6,
bin_count=2048,
resolution_bw=50.0,
on_spectrum=on_spectrum,
) as stream:
import time; time.sleep(30)Documentation
- API Reference, Architecture, and Recipes docs updated
- New
examples/spectrum_example.py - 13 new unit tests
Install
pip install ka9q-python==3.12.0