Automated 24/7 Shortwave Waterfall Logging & Anomaly Detection in Python
Listening to a 24/7 shortwave marker channel manually is impossible. A tiny single-board computer running a Python ring buffer can monitor a 12 kHz baseband slice continuously, compute rolling spectral energy, and archive audio clips only when the baseline marker pattern shifts or voice traffic appears.
Minimal Rolling SNR Anomaly Detector
import numpy as np
def detect_carrier_shift(samples: np.ndarray, baseline_db: float, threshold_db: float = 6.0) -> tuple[bool, float]:
window = np.hanning(len(samples))
spectrum = np.abs(np.fft.rfft(samples * window))
peak_db = float(20 * np.log10(np.max(spectrum) + 1e-12))
is_anomaly = abs(peak_db - baseline_db) >= threshold_db
return is_anomaly, peak_db
Operational Best Practices for 24/7 RF Nodes
- Write to RAM disk first: Buffer rolling 60-second segments in
/dev/shmand flush to SD/SSD only on trigger events to prevent flash wearout. - Log UTC ISO-8601 timestamps: Always name archived clips in UTC (e.g.,
2026-11-20T031500Z_4625khz.flac) so multi-station logs align cleanly. - Watchdog heartbeats: Emit a lightweight health ping every 5 minutes so silent USB SDR disconnects are detected immediately.