Software decoder for FM/AM broadcast radio with AirSpy R2 / Mini, Airspy HF+, and RTL-SDR
See CONTRIBUTING.md for the details.
Please read CHANGES.md before using the software.
# Portaudio output
airspy-fmradion -t airspy -q \
-c freq=88100000,srate=10000000,lgain=2,mgain=0,vgain=10 \
-b 1.0 -P -
# 16-bit signed integer WAV output (pipe is not supported)
airspy-fmradion -t airspyhf -q \
-c freq=88100000,srate=768000 \
-b 1.0 -W output_s16_le.wav
# 32-bit float WAV output (pipe is not supported)
airspy-fmradion -m am -t airspyhf -q \
-c freq=666000 \
-b 0.5 -G output_f32_le.wav
For the latest version, see https://github.com/jj1bdx/airspy-fmradion
master
branch is deprecated and to be deleted. Use main branch.Use the latest version of Airspy HF+ firmware, available at Airspy HF+ Dual Port and Airspy HF+ Discovery Web pages.
airspy-fmradion sets the default sampling rates to 384kHz for FM broadcast, and 192kHz for the other modes. Old Airspy HF+ firmwares do not support the lower sampling rate other than 768kHz.
Note: the main (formerly master) branch of libvolk is now required from v0.8.1.
If you install from source in your own installation path, you have to specify the include path and library path.
For example if you installed it in /opt/install/libairspy
you have to add -DAIRSPY_INCLUDE_DIR=/opt/install/libairspy/include -DAIRSPYHF_INCLUDE_DIR=/opt/install/libairspyhf/include
to the cmake options.
sudo apt-get install cmake pkg-config libusb-1.0-0-dev libasound2-dev libairspy-dev libairspyhf-dev librtlsdr-dev libsndfile1-dev portaudio19-dev
airspy
and airspyhf
brew tap pothosware/homebrew-pothos
brew tap dholm/homebrew-sdr #other sdr apps
brew update
brew install portaudio
brew install libsndfile
brew install rtl-sdr
brew install airspy --HEAD
brew install airspyhf --HEAD
brew install volk
Install libvolk as described in INSTALL-latest-libvolk.md.
Use the latest HEAD version.
Note: this is applicable for both macOS and Linux.
Install and use the latest libairspy --HEAD version for:
airspy_open_devices()
, required by airspy_open_sn()
. See this commit for the details.if_blocksize
for Airspy HF+ is reduced from 16384 to 2048, following this commit.r8brain-free-src and readerwriterqueue are the submodules of this repository. Download the submodule repositories by the following git procedure:
git submodule init
git submodule update
To install airspy-fmradion, download and unpack the source code (as well as the r8brain-free-src submodule) and go to the top level directory. Then do like this:
mkdir build
cd build
cmake ..
CMake tries to find librtlsdr. If this fails, you need to specify the location of the library in one the following ways:
cmake .. \
-DAIRSPY_INCLUDE_DIR=/path/airspy/include \
-DAIRSPY_LIBRARY_PATH=/path/airspy/lib/libairspy.a
-DAIRSPYHF_INCLUDE_DIR=/path/airspyhf/include \
-DAIRSPYHF_LIBRARY_PATH=/path/airspyhf/lib/libairspyhf.a \
-DRTLSDR_INCLUDE_DIR=/path/rtlsdr/include \
-DRTLSDR_LIBRARY_PATH=/path/rtlsdr/lib/librtlsdr.a
PKG_CONFIG_PATH=/path/to/airspy/lib/pkgconfig cmake ..
For using static analyzers such as OCLint and Clangd, run the following commands:
cd build
ln -s `pwd`/compile_commands.json ..
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
make -j4
(for machines with 4 CPUs)make install
On M1 Mac, using cp causes a trouble. Use the following command to properly install the command to a local directory:
install -o user -m 0700 -c -s build/airspy-fmradion $(HOME)/bin
-m devtype
is modulation type, one of fm
, nbfm
, am
, dsb
, usb
, lsb
, cw
, wspr
(default fm)-t devtype
is mandatory and must be airspy
for Airspy R2 / Airspy Mini, airspyhf
for Airspy HF+, rtlsdr
for RTL-SDR, and filesource
for the File Source driver.-q
Quiet mode.-c config
Comma separated list of configuration options as key=value pairs or just key for switches. Depends on device type (see next paragraph).-d devidx
Device index, 'list' to show device list (default 0)-M
Disable stereo decoding-R filename
Write audio data as raw S16_LE
samples. Use filename -
to write to stdout-F filename
Write audio data as raw FLOAT_LE
samples. Use filename -
to write to stdout-W filename
Write audio data as RF64/WAV S16_LE
samples. Use filename -
to write to stdout (pipe is not supported)-G filename
Write audio data as RF64/WAV FLOAT_LE
samples. Use filename -
to write to stdout (pipe is not supported)-P device_num
Play audio via PortAudio device index number. Use string -
to specify the default PortAudio device-T filename
Write pulse-per-second timestamps. Use filename '-' to write to stdout-b seconds
(ignored, remained for a compatibility reason)-X
Shift pilot phase (for Quadrature Multipath Monitor) (-X is ignored under mono mode (-M))-U
Set deemphasis to 75 microseconds (default: 50)-f
Set Filter type
-l dB
Enable IF squelch, set the level to minus given value of dB-E stages
Enable multipath filter for FM (For stable reception only: turn off if reception becomes unstable)-r ppm
Set IF offset in ppm (range: +-1000000ppm) (Note: this option affects output pitch and timing: use for the output timing compensation only!
-A
(For FM only) Experimental 10Hz-step IF AFCpps_index sample_index unix_time if_level
block unix_time if_level
-r
option.Tp
[seconds] and output buffer length (buf=
in the debug output) increases during the time is Ts
[seconds], the compensation rate is (Ts/Tp) * 1000000
[ppm].IfResampler
class, which causes more CPU usage.adjust_gain()
is reintroduced) again, as in pre-v0.2.7adjust_gain()
is removed)r8b::CDSPResampler24
is used for IF resamplingfast_atan2f()
which has ~20-bit accuracy, is used for PhaseDiscriminator class and the 19kHz pilot PLL.fastatan2()
used in v0.6.10 and before was removed due to low accuracy (of ~10 bits)atan2()
to fast_atan2f()
showed no noticeable difference of the THD+N (0.218%) and THD (0.018%). (Measured from JOBK-FM NHK Osaka FM 88.1MHz hourly time tone 880Hz, using airwaves after the multipath canceler filter of -E36)fastatan2()
allowed +-0.005 radian max error
atan2()
allows only approx. 0.5 ULP as the max error for macOS 10.14.5, measured by using the code from "Error analysis of system mathematical functions
" by Gaston H. Gonnet (1 ULP for macOS 64bit double
= 2^(-53) = approx. 10^(15.95))-E
optionsboost::lockfree::spsc_queue
didn't make things faster, and consumed x2 CPU power)doc/filter-design
doc/filter-design
default
filter width: +-10kHz-f
options: middle
+-8kHz, narrow
+-6.25kHz-f
options: wide
+-20kHz (with wider deviation of +-17kHz)doc/filter-design
default
filter width: +-6kHz-f
options: middle
+-4.5kHz, narrow
+-3kHz-f
options: wide
+-9kHzfreq=<int>
Desired tune frequency in Hz. Valid range from 1M to 1.8G. (default 100M: 100000000
)srate=<int>
Device sample rate. list
lists valid values and exits. (default 10000000
). Valid values depend on the Airspy firmware. Airspy firmware and library must support dynamic sample rate query.lgain=<x>
LNA gain in dB. Valid values are: 0, 1, 2, 3, 4, 5, 6, 7, 8 ,9 ,10, 11 12, 13, 14, list
. list
lists valid values and exits. (default 8
)mgain=<x>
Mixer gain in dB. Valid values are: 0, 1, 2, 3, 4, 5, 6, 7, 8 ,9 ,10, 11 12, 13, 14, 15, list
. list
lists valid values and exits. (default 8
)vgain=<x>
VGA gain in dB. Valid values are: 0, 1, 2, 3, 4, 5, 6, 7, 8 ,9 ,10, 11 12, 13, 14, 15, list
. list
lists valid values and exits. (default 0
)antbias
Turn on the antenna bias for remote LNA (default off)lagc
Turn on the LNA AGC (default off)magc
Turn on the mixer AGC (default off)freq=<int>
Desired tune frequency in Hz. Valid range from 0 to 31M, and from 60M to 240M. (default 100M: 100000000
)srate=<int>
Device sample rate. list
lists valid values and exits. (default 384000
). Valid values depend on the Airspy HF firmware. Airspy HF firmware and library must support dynamic sample rate query.hf_att=<int>
HF attenuation level and AGC control.
freq=<int>
Desired tune frequency in Hz. Accepted range from 10M to 2.2G.
(default 100M: 100000000
)gain=<x>
(default auto
)
auto
Selects gain automaticallylist
Lists available gains and exit<float>
gain in dB. Possible gains in dB are: 0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8 , 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6
srate=<int>
Device sample rate. valid values in the [900001, 3200000] range. (default 1152000
)blklen=<int>
Device block length in bytes (default RTL-SDR default i.e. 64k)agc
Activates device AGC (default off)antbias
Turn on the antenna bias for remote LNA (default off)freq=<int>
Frequency of radio station in Hz.srate=<int>
IF sample rate in Hz.filename=<string>
Source file name. Supported encodings: FLOAT
, S24_LE
, S16_LE
zero_offset
Set if the source file is in zero offset, which requires Fs/4 IF shifting.blklen=<int>
Set block length in samples.raw
Set if the file is raw binary.format=<string>
Set the file format for the raw binary file. Supported formats: U8_LE
, S8_LE
, S16_LE
, S24_LE
, FLOAT