GithubHelp home page GithubHelp logo

jj1bdx / airspy-fmradion Goto Github PK

View Code? Open in Web Editor NEW
136.0 11.0 19.0 44.91 MB

Software decoder for FM/AM broadcast radio with AirSpy R2 / Mini, Airspy HF+, and RTL-SDR

License: GNU General Public License v3.0

CMake 3.05% C++ 94.37% Python 2.58%
airspy sdr software-defined-radio radio macos linux fm fm-radio audio ubuntu

airspy-fmradion's Introduction

airspy-fmradion

  • Version 20240424-0
  • For macOS (Apple Silicon) and Linux

Contributing

See CONTRIBUTING.md for the details.

Known issues and changes

What is airspy-fmradion?

  • airspy-fmradion is software-defined radio receiver (SDR) software with command-line interface.

What does airspy-fmradion provide?

  • Supported SDR frontends: Airspy R2/Mini, Airspy HF+, and RTL-SDR
  • Playing back from I/Q WAV files
  • Monaural/stereo decoding of FM broadcasting stations
  • Monaural decoding of AM stations
  • Decoding NBFM/DSB/USB/LSB/CW/WSPR station audio
  • Playback to soundcard through PortAudio or saving to file through libsndfile
  • Command-line interface

Usage

# Portaudio output
airspy-fmradion -t airspy -q \
    -c freq=82500k,srate=1000k,lgain=2,mgain=0,vgain=10 \
    -P -

# 16-bit signed integer WAV output (pipe is not supported)
airspy-fmradion -t airspyhf -q \
    -c freq=82500000,srate=384000 \
    -W output_s16_le.wav

# 32-bit float WAV output (pipe is not supported)
airspy-fmradion -m am -t airspyhf -q \
    -c freq=666k \
    -G output_f32_le.wav

airspy-fmradion requirements

Git branches and tags

  • Official releases are tagged
  • main is the "production" branch with the most stable release (often ahead of the latest release though)
  • dev is the development branch that contains current developments that will be eventually released in the main branch
  • Other branches are experimental (and presumably abandoned)

Prerequisites

Debian/Ubuntu Linux

sudo apt-get install cmake pkg-config \
    libusb-1.0-0-dev \
    libasound2-dev \
    libairspy-dev \
    libairspyhf-dev \
    librtlsdr-dev \
    libsndfile1-dev \
    portaudio19-dev \
    libvolk2-dev

macOS

  • Install HomeBrew libraries as in the following shell script
  • Use HEAD for airspy and airspyhf
brew update
brew install portaudio
brew install libsndfile
brew install rtl-sdr
brew install airspy --HEAD
brew install airspyhf --HEAD
brew install volk

Install the supported libvolk

  • Install libvolk as described in libvolk.md.
  • Run volk_profile and save the configuration data for speed optimization.

Install the supported libsndfile for MP3 capability

  • You may need to install libsndfile as described in libsndfile.md.

Installation

/bin/rm -rf build
mkdir build
git submodule update --init --recursive
cmake -S . -B build
cmake --build build --target all

Basic command options

  • -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)
  • -C filename Write audio data to MP3 file of VBR -V 1. Use filename '-' to write to stdout. (This function is available when linked with supported libsndfile only.)
  • -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
  • -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
    • for FM: wide and default: none, medium: +-156kHz, narrow: +-121kHz
    • for AM: wide: +-9kHz, default: +-6kHz, medium: +-4.5kHz, narrow: +-3kHz
    • for NBFM: wide: +-20kHz, default: +-10kHz, medium: +-8kHz, narrow: +-6.25kHz
  • -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!

Timestamp file format

  • For FM: pps_index sample_index unix_time if_level
  • For the other modes: block unix_time if_level
  • if_level is in dB

Output audio specification

  • Output maximum level is nominally -6dB (0.5) but may increase up to 0dB (1.0)
  • Output audio sample rate is fixed to 48000Hz

FM multipath filter

  • A Normalized LMS-based multipath filter can be enabled after IF AGC
  • IF sample stages is defined by -E options
  • Practical upper limit of -E value: 200
  • Practical -E value: up to 50 for Raspberry Pi 4, approx. 100 for a modern computer

Airspy R2 / Mini configuration options

  • freq=<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)

Airspy HF+ configuration options

  • 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.
    • 0: enable AGC, no attenuation
    • 1 - 8: disable AGC, apply attenuation of value * 6dB

RTL*SDR configuration options

  • freq=<int> Desired tune frequency in Hz. Accepted range from 10M to 2.2G. (default 100M: 100000000)
  • gain=<x> (default auto)
    • auto Selects gain automatically
    • list 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)

File Source driver configuration options

  • 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

Authors and contributors

License

  • As a whole package: GPLv3 (and later). See LICENSE.
  • Each source code file might state a GPLv3-compatible license.

[End of README.md]

airspy-fmradion's People

Contributors

argilo avatar bstalk avatar f4exb avatar jj1bdx avatar ryanlovett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

airspy-fmradion's Issues

Reorganize README.md

It's no longer a decent README file anymore, as of 20201204-0.

Possible actions:

  • Split the README.md into many parts
  • The main README.md should contain minimal stuff
  • Changelog should be another file

clang-tidy warnings as of 20240106

Two major warning cases found on 20240106

According to CMU SEI C/C++ Coding Standards:

ERR33-C. Detect and handle standard library errors

  • Use of fprintf(stderr, ...) should be replaced by a more abstract function:
/Users/kenji/src/airspy-fmradion/main.cpp:182:3: error: the value returned by this f
unction should be used [cert-err33-c,-warnings-as-errors]
  182 |   fprintf(stderr, "ERROR: Invalid argument for %s\n", label);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kenji/src/airspy-fmradion/main.cpp:182:3: note: cast the expression to void t
o silence this warning

Also:

ERR58-CPP. Handle all exceptions thrown before main() begins executing

  • Statically-defined filter parameters of std::vector should be initialized runtime:
/Users/kenji/src/airspy-fmradion/sfmbase/FilterParameters.cpp:851:39: error: initial
ization of 'jj1bdx_fm_384kHz_narrow' with static storage duration may throw an excep
tion that cannot be caught [cert-err58-cpp,-warnings-as-errors]
  851 | const IQSampleCoeff FilterParameters::jj1bdx_fm_384kHz_narrow = {
      |                                       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:465:5:
 note: possibly throwing constructor declared here
  465 |     vector(initializer_list<value_type> __il);
      |     ^

Other cases

I also observe another warning cases because of r8brain-free-src code, but this is not really fixable in airspy-fmradion.

/Users/kenji/src/airspy-fmradion/r8brain-free-src/CDSPBlockConvolver.h:179:3: error:
 Call to virtual method 'CDSPBlockConvolver::clear' during construction bypasses vir
tual dispatch [clang-analyzer-optin.cplusplus.VirtualCall,-warnings-as-errors]
  179 |                 clear();
      |                 ^
/Users/kenji/src/airspy-fmradion/sfmbase/AudioResampler.cpp:27:15: note: Calling con
structor for 'CDSPResampler'
   27 |           new r8b::CDSPResampler(input_rate, output_rate, max_input_length))
 {
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CAT / Hamlib control

CAT / Hamlib control is needed to support automatic frequency change for WSJT-X and JTDX.

Things to do:

  • Design reconsideration (airspy-fmradion is not designed for dynamically changing the receiving frequencies)
  • Implement frequency change and receiving mode change functions
  • Add TCP server thread
  • Implement CAT / Hamlib communication support (through TCP)

`volk_32fc_x2_s32fc_multiply_conjugate_add_32fc' is deprecated on VOLK 3.1.0

Maybe we need to fix this ASAP.

[ 87%] Building CXX object CMakeFiles/sfmbase.dir/sfmbase/RtlSdrSource.cpp.o
/home/kenji/src/airspy-fmradion/sfmbase/MultipathFilter.cpp: In member function 'void MultipathFilter::update_coeff(IQSample)':
/home/kenji/src/airspy-fmradion/sfmbase/MultipathFilter.cpp:136:3: warning: 'volk_32fc_x2_s32fc_multiply_conjugate_add_32fc' is deprecated [-Wdeprecated-declarations]
  136 |   volk_32fc_x2_s32fc_multiply_conjugate_add_32fc(
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/volk/volk_alloc.hh:18,
                 from /home/kenji/src/airspy-fmradion/include/SoftFM.h:30,
                 from /home/kenji/src/airspy-fmradion/include/MultipathFilter.h:23,
                 from /home/kenji/src/airspy-fmradion/sfmbase/MultipathFilter.cpp:31:
/usr/local/include/volk/volk.h:1895:61: note: declared here
 1895 | extern VOLK_API p_32fc_x2_s32fc_multiply_conjugate_add_32fc volk_32fc_x2_s32fc_multiply_conjugate_add_32fc __attribute__((deprecated));
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Airspy HF+ Firmware R4.0.8 and libairspyhf 1.8 support

Compatibility tests with the new firmware R4.0.8-BB/CD of Airspy HF+ Dual Port/Discovery should be conducted.

Checklist:

  • R4.0.8 firmware compatibility test with current airspy-fmradion 20240316-0 + libairspyhf version 1.6.8: successfully done on both Dual Port and Discovery on macOS and Ubuntu
  • Testing R4.0.8 firmware + the latest (HEAD) libairspyhf combination with current airspy-fmradion 20240316-0, by updating the libairspyhf with the latest version: libairspyhf update successfully done on macOS, Ubuntu, and Raspberry Pi OS 64bit Lite, and airspy-fmradion worked OK with the latest libairspyhf
  • Adding a document for the changes by R4.0.8 and libairspyhf 1.8

Utilizing new functionality in the latest libairspyhf from airspy-fmradion AirspyHFSource driver will be another issue.

AM AGC ducking

AM AGC still ducks (works not smoothly). The IF AGC seems to be alright. The AF AGC might have a problem due to:

  • Larger blocks to handle. Currently ~2873 samples for 48kHz output, which means ~60ms/block for Airspy HF+ 192kbps IF, which is too coarse.
  • The block size varies. This may affect a lot on the AGC processing quality.

Possible workarounds:

  • Buffer the input, divide into smaller chunks to process, and concatenate the results Multiple 256-sample blocks for 48kHz might help (~5.12ms/block). Unprocessed input (less than the chunk size) should be remembered and processed together with the next block.
  • Introducing an algorithm capable to handle variable length of the input.

Exit on Write Error??

I am running airspy-fmradion in a script, piping the output to lame and then to ezstream. This script is installed as a systemd service.

I have issues where at some point the process breaks and I get 'ERROR: AudioOutput: write failed (Broken pipe)'.

I see this is in main.cpp. Does it make sense to have the program either default to exiting, or provide an option for the program to exit in this case? I was planning to add stop_flag.store(true); to the condition in write_output_data - but I have yet to try this.

Maybe there's another way I can catch this error and exit the program?

Best SDR device to reduce interference?

I have been using airspy-fmradion with a rtl-sdr dongle with great results for FM radio listening, but unfortunately I hear static (I assume due to EMI interference) depending on where I place the device. My laptop seems to be the worst offender. I'm curious if stepping up to an airspy device (R2, mini, HF+) might help with eliminating the static? Do these devices have better shielding?

Raspberry Pi evaluation

There would be no show-stopper for Raspberry Pi on airspy-fmradion, because no architecture-dependent libraries are used either on Linux or macOS. Operating airspy-fmradion on Ras Pi is technically feasible and should be pursued for the real-world application.

Dropping of received data observed in v0.8.4

The frequent dropping of received data up to approx. 4 seconds observed in v0.8.4 when recording FM broadcast, on macOS 10.14.6 running on a Mac mini 2018.
Possible cause: setting the buffering time to a very small value when recording to a file as the default setting. This should be fixed. One second of buffering as the default value might solve this problem. Latency is still much better than losing data.

Error : this file format does not support pipe write.

Per the Usage specs:

-W filename    Write audio data to RF64/WAV S16_LE file
                 use filename '-' to write to stdout

However, I try to pipe to ffmpeg with the following:
airspy-fmradion -t airspyhf -q -c freq=105300000,srate=384000 -b 1.0 -W - | ffmpeg -f s16le -ar 48000 -ac 2 -i - -c:a libfdk_aac -b:a 192k -ar 48000 -af "volume=5dB" -y out.aac

It returns the following error:

airspy-fmradion 20211209-0
Software FM/AM radio for Airspy R2, Airspy HF+, and RTL-SDR
output buffer length: 1 [s]
writing RF64/WAV int16 audio samples to '-'
ERROR: AudioOutput: can not open '-' (Error : this file format does not support pipe write.)

Am I missing something?

Smaller latency for CW/SSB/WSPR reception

Things to do:

  • Stop using 48kHz <-> 12kHz resampling
    • Increase latency during these rate conversions
  • Steep filter for CW/SSB with 48kHz sampling rate
    • Order: > 1000
      • How to design? SciPy? pyfda?
    • CW/WSPR: 250Hz (i.e., +-125Hz) 0dB passband bandwidth, 400Hz -90dB passband bandwidth
    • SSB: 2800Hz (i.e., +-1500Hz) 0dB passband bandwidth, 3000Hz -90dB passband bandwidth

RPi 3 install troubles

I have successfully intsalled this on my x86 box, but never saw this issue with mako. I think mako installed

pip install mako
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting mako
Downloading https://files.pythonhosted.org/packages/b0/3c/8dcd6883d009f7cae0f3157fb53e9afb05a0d3d33b3db1268ec2e6f4a56b/Mako-1.1.0.tar.gz (463kB)
100% |████████████████████████████████| 471kB 483kB/s
Collecting MarkupSafe>=0.9.2 (from mako)
Downloading https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz
Building wheels for collected packages: mako, MarkupSafe
Running setup.py bdist_wheel for mako ... done
Stored in directory: /root/.cache/pip/wheels/98/32/7b/a291926643fc1d1e02593e0d9e247c5a866a366b8343b7aa27
Running setup.py bdist_wheel for MarkupSafe ... done
Stored in directory: /root/.cache/pip/wheels/f2/aa/04/0edf07a1b8a5f5f1aed7580fffb69ce8972edc16a505916a77
Successfully built mako MarkupSafe
Installing collected packages: MarkupSafe, mako
Successfully installed MarkupSafe-1.1.1 mako-1.1.0

but when I tried to install libvolk, I get

-- Python checking for mako >= 0.4.2
-- Python checking for mako >= 0.4.2 - not found

-- Python checking for six - python 2 and 3 compatibility library
-- Python checking for six - python 2 and 3 compatibility library - found
CMake Error at CMakeLists.txt:93 (message):
Mako templates required to build VOLK

-- Configuring incomplete, errors occurred!

Problems with make

I get through all the cmake stuff OK I think.... I see this:, but my interpreatation is that libsoxr does get found and it is there when I look:

-- Checking for module 'libsoxr'
-- No package 'libsoxr' found
-- libsoxr: /usr/local/include, /usr/local/lib/libsoxr.so

cmake ends with:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jim/Apps/airspy-fmradion/build

But when I try to make it I get this:

[ 4%] Building CXX object CMakeFiles/sfmbase.dir/sfmbase/AirspyHFSource.cpp.o
/home/jim/Apps/airspy-fmradion/sfmbase/AirspyHFSource.cpp: In member function ‘bool AirspyHFSource::configure(int, uint8_t, uint32_t)’:
/home/jim/Apps/airspy-fmradion/sfmbase/AirspyHFSource.cpp:205:16: error: ‘airspyhf_is_low_if’ was not declared in this scope
int low_if = airspyhf_is_low_if(m_dev);
^~~~~~~~~~~~~~~~~~
/home/jim/Apps/airspy-fmradion/sfmbase/AirspyHFSource.cpp:205:16: note: suggested alternative: ‘airspyhf_stop’
int low_if = airspyhf_is_low_if(m_dev);
^~~~~~~~~~~~~~~~~~
airspyhf_stop
and it fails.

What am I doing wrong?

Multi-channel decoding (new feature)

is it possible to make the stereo FM-decoding for the multiple stations at the same time?

There is a software tool https://github.com/pvachon/tsl-sdr/wiki/Using-MultiFM that enables to configure multiple filtered output from a wideband stream. The typical configuration looks like:

"device" : {
"type" : "rtlsdr",
"deviceIndex" : 0,
"dBGainLNA" : 30
},
"sampleRateHz" : 2400000,
"centerFreqHz" : 104600000,
"nrSampBufs" : 128,
"decimationFactor" : 12,

"channels" : [
{
"outFifo" : "/tmp/ch1.out",
"chanCenterFreq" : 104600000,
"signalDebugFile": "/tmp/ch1.iq"
}

]
}
...

Multifm supports only basic fm-demodulation but can output filtered streams to FIFO ("signalDebugFile"-option). I changed the filter from multifm and was able to decode and play the resulted stream (from signaldebugfile-fifo) using Matlab or GNU Radio (incl. Stereo-FM decoding and RDS).

The idea is following: if you could extend airspy-fmradion with a support of a virtual fifo device (or just file input) with configurable sample rates that could be really great. If you could support the provided format from multifm (Qf-16 bit) than it will be ideal. In such case, single FM-decoders can be started as separate processes and the resulted streams can be sent for the processing to the further pipe; e.g. ffmpeg or ices.

Thanks in advance for your consideration.

libusb-1.0.25 on macOS 12.2 causes segfault when stopping the code with SIGINT or SIGTERM with Airspy HF+ Discovery

WIP commit: 25c2b2c

Error message:

Stopping by getting signal: Interrupt

libusb: debug [libusb_free_transfer] transfer 0x7f8098307b38
zsh: segmentation fault  airspy-fmradion -m fm -E15 -t airspyhf -c freq=89700000 -b 0.1 -P -

This segfault happens after exiting the main loop in main.cpp. libusb_free_transfer is called from airspyhf_stop().

Confirmed on Mac mini 2018 with macOS 12.2. Also occasionally (less frequently) happened on M1 MacBook Air 13" 2020 with macOS 12.2. This segfault didn't happen with libusb-1.0.24 of Homebrew, nor on Ubuntu 21.10 amd64 with libusb-1.0.0-dev based on 1.0.24.

Is this compatible with Raspberry Pi 3?

I managed to build this but have a major problem. The CPU load for the process is around 135%, and after a few seconds it displays a warning that the Input buffer is filling up (system too slow).
Then the process dies silently.
I watched "top" while this ran, and found that the RAM usage goes up pretty quickly. It must be running out of memory.

This is how I'm running it:
airspy-fmradion -t airspy -c antbias=on -c freq=137500000,srate=3000000,lgain=2,mgain=0,vgain=10 -M -b 1.0 -R - | /usr/bin/sox -t raw -e signed -c 1 -b 16 -r 48000 - test.wav rate 11025

I want to use this with WXtoIMG to receive APT weather satellites. I have it working with rtl_fm but I wanted to try if there was a difference with the Airspy

tweak for Airspy HF usage text

--- main.cpp	2019-06-15 09:30:57.120415401 -0400
***************
*** 171,177 ****
        "\n"
        "Configuration options for Airspy HF devices:\n"
        "  freq=<int>     Frequency of radio station in Hz (default 100000000)\n"
!       "                 valid values: 60M to 260M\n"
        "  srate=<int>    IF sample rate in Hz.\n"
        "                 Depends on Airspy HF firmware and libairspyhf support\n"
        "                 Airspy HF firmware and library must support dynamic\n"
--- 171,177 ----
        "\n"
        "Configuration options for Airspy HF devices:\n"
        "  freq=<int>     Frequency of radio station in Hz (default 100000000)\n"
!       "                 valid values: 9k to 31M and 60M to 260M\n"
        "  srate=<int>    IF sample rate in Hz.\n"
        "                 Depends on Airspy HF firmware and libairspyhf support\n"
        "                 Airspy HF firmware and library must support dynamic\n"

Further speedup on ARM CPUs

Refactoring atan and atan2 of VOLK is needed.

  • Intel x86_64 CPU refactoring is well done with this algorithm.
  • Maybe implementing the same algorithm with ARM intrinsic is enough?

Cannot change sample rate

I found out from reviewing the code, that the '-r' option has been removed.

I'm sure there's a good reason for this, but it took me by surprise when I tried to experiment to see if different sampling rates would change the quality of the output.

sample rate error at runtime

Not to be a newbie pest.... but.. it build OK and now see this when using one of the examples

(base) jim@Desktop:/$ airspy-fmradion -m am -t airspyhf -q -c freq=666000 -b 0.5 -F - | play --buffer=1024 -t raw -e floating-point -b32 -r 48000 -c 1 -q -
airspy-fmradion v0.8.2
Software FM/AM radio for Airspy R2, Airspy HF+, and RTL-SDR
output buffer length: 0.5 [s]
writing raw 32-bit float little-endian audio samples to '-'
play WARN alsa: can't encode 0-bit Unknown or not applicable
using device 0: Serial dd5297aa2fbf3448
ERROR: configuration: Invalid sample rate in AirspyHFSource::configure initialization

Build issue on Arch

Hi

I have Arch Linux OS and I'm trying to build latest version but some errors occurs:

-- volk 3.1: /usr/lib/libvolk.so
-- libairspy 1.0: /usr/include/libairspy, AIRSPY_LIBRARY-NOTFOUND
-- libairspyhf 1.7: /usr/include/libairspyhf, AIRSPYHF_LIBRARY-NOTFOUND
-- librtlsdr 2.0.1: /usr/include, RTLSDR_LIBRARY-NOTFOUND
-- libusb 1.0.27: /usr/include/libusb-1.0, /usr/lib/libusb-1.0.so
-- sndfile 1.2.2: /usr/lib/libsndfile.so, /usr/include
-- sndfile MP3 support enabled
-- libportaudio 19: /usr/include, /usr/lib/libportaudio.so
-- PortAudio libs: /usr/lib/libportaudio.so;/usr/lib/libasound.so;/usr/lib/libm.so;/usr/lib/libpthread.a
-- Configuring done (0.3s)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
AIRSPYHF_LIBRARY
    linked by target "sfmbase" in directory /home/roygbiv/test/airspy-fmradion
AIRSPY_LIBRARY
    linked by target "sfmbase" in directory /home/roygbiv/test/airspy-fmradion
RTLSDR_LIBRARY
    linked by target "sfmbase" in directory /home/roygbiv/test/airspy-fmradion

I have all those libraries but still not found, eg for airspy below:

ls /usr/include/libairspy
.rw-r--r-- root root 9.7 KB Fri May 28 17:25:32 2021  airspy.h
.rw-r--r-- root root 4.7 KB Fri May 28 17:25:32 2021  airspy_commands.h
.rw-r--r-- root root 2.7 KB Fri May 28 17:25:32 2021  filters.h
.rw-r--r-- root root 1.7 KB Fri May 28 17:25:32 2021  iqconverter_float.h
.rw-r--r-- root root 1.6 KB Fri May 28 17:25:32 2021  iqconverter_int16.h

Audio rate configuration issue / OOM on Ras Pi 4

Using the following syntax causes slowed-down audio:

airspy-fmradion -t airspy -c freq=88000000,srate=6000000,mgain=12 -b 1.0 -R - | sox -t raw -r 40000 -es -b16 -c1 -V1 - test.wav rate 11025

I can adjust the audio speed bij adding the tempo or speed parameter in sox, but when using rtl_fm I don't need to use that parameter. How can I pipe the output to sox with the original speed?

stereo decoder ? (New feature)

Hi,
I would like to use part of this project, just to make a stereo decoder, but I don't know if it's possible.
I want RDS and Stereo, so I need to use rtl_fm command line and redsea decoder.
$ rtl_fm ......... | redsea -e

RTL_FM gives to redsea a MPX signal (171 or 192 KHz) which redsea, decodes RDS and gives output in json format.
Redsea -e parameter echoes the input (stdin) signal to stdout and print decoded groups to stderr, so what I would like is a simple stereo decoder which take MPX signal from redsea ouput (stdout), decodes stsreo sound and give ouput in S16LE 2 channel output....

So command line would be like this...

rtl_fm -M fm -l 0 -A std -s 171k -F 9 -f 87.9M | redsea -e | stereodecoder | aplay -r 171k -f S16_LE -c 2

Is it possible to use some parts to get this stereodecoder?

Specifying duration to record + audio out question

I have two Airspys (or two RTL-SDRs) setup to record at progressive times, overlapping by a second. So, first SDR records 0 - 6 sec (to wav), second SDR 5 - 11 sec (to wav), first again 10 - 16 sec (to wav), second again 15 - 21 sec (to wav), so forth and so on. The reason, I want to check each interval for key phrases and words at a regular rep rate. The first and second SDRs are commanded from from separate threads, wav files are dumped into a common directory for examination. I've set this up on both an Ubuntu system and a Fedora system to cross check functionality.

First question. With your very convenient program here -- love it -- how do I specify the duration of recording vice just commanding ^C to kill the program and stop the process. I didn't see anything in the help that states a clean way of stopping, vice just forcing it closed.

Second question. I still don't have PortAudio working to go to a default audio device on the Fedora system, although it works just fine on the Ubuntu system. It's something to do with PortAudio interfacing with the MIMIX mini pc the Fedora instantiation is loaded onto I think. Now, the wav file functionality is all I really need for now, and that works on both Ubuntu and Fedora compilations of aispy-fmradion just fine. So, finally to the question. Is there another way of trying to specify an audio out (not to file) besides the "-P -" I could try on the Fedora system?

Thx!

Feature requst - MPX output

Hi,

Would be very useful to send pure MPX signal to stdout or soundcard with 192kHz sample rate, and probability easy to implement.

thx

Install on Fedora 37

I am running into challenges installing this onto Fedora. Do you have any pointers? The rb8 library seemed to compile OK, libr8b.a. The I get errors in the volk library.

"fatal error: volk/volk_alloc.hh: No such file or directory"
"#include <vold/volk_alloc.hh>"

I am sure there will be others, but that is the first. Have you installed this onto a Fedora version of Linux before? I was able to install everything just fine last night onto Ubuntu on another system. It works great by the way. I can't get Fedora 37 to cooperate. It might have something to do with the Fedora version of the volk library. Thx.

FM multipath filter coefficient optimization

Observations from @rsuzuki0 of the 72-stage experiment results in this video file:

  • The reference position (where initial coefficient = 1 + 0j) should be moved to a later position so that more previous (early time) samples (reflected waves) and less later samples (early-reflected waves) should be affected to the calculated output. Currently, the length ratio is 1:1. A new ratio of 3:1 or even 4:1 should be considered.
  • Phase of the previous (early time) samples looks much more stable (converged) than the later samples.

MP3 output support via libsndfile

Things to consider:

  • Supported output formats
    • Not giving too many options -> one option only
      • I don't want to make command parsing too complex
    • mono and joint-stereo -> automatically chosen
      • no dual-channel stereo (FM stereo is joint-stereo by definition)
    • bitrate -> VBR (LAME -V 1)
      • 320kbps stereo for archiving reference
      • 192kbps joint-stereo mode for a good FM recording quality
      • 48kbps mono for AM radio?
      • I'd rather choose 64kbps mono for AM radio in full-quality
    • ID3 header to add -> not doing this
      • Time info only, minimal -> the pps.txt file will do

fldigi stops after a few seconds while receiving audio from airspy-fmradion via snd-aloop

Running on dietpi.
Starts fine, and without printing any error stops the output of audio, as fldigi stops receiving data.

Log:

airspy-fmradion -t airspyhf -q -m usb -c freq=13881000,hf_att=0 -P -
airspy-fmradion 20231216-0
Software FM/AM radio for Airspy R2, Airspy HF+, and RTL-SDR
VOLK_VERSION = 020502
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_a52.c:1001:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib conf.c:5670:(snd_config_expand) Unknown parameters {AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2 CARD 0}
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2 CARD 0}
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
playing audio to PortAudio default device: name 'default'
using device 0: Serial 2f528d8095444ad5
tuned for 13.881 [MHz]
Decoding modulation type: usb
IF sample rate: 384000 [Hz], IF decimation: / 8
Demodulator rate: 48000 [Hz], audio decimation: / 1
AM demodulator deemphasis: 100 [µs]
Filter type: default

VOLK 3.1.0 does not work on Ubuntu 22.04.3 x86_64 with airspy-fmradion 20231212-1

Synopsis:

airspy-fmradion with multipath filter enabled for broadcast FM generates -NaN output on ppm and AF level monitor output when compiled and running with Ubuntu 22.04.3 x86_64 and VOLK 3.1.0, both compiled by GCC 12.3.0.

Reported at:

Findings so far:

  • volk_32fc_x2_s32fc_multiply_conjugate_add_32fc of VOLK v3.1.0 worked OK on macOS 14.2 (Homebrew) with airspy-fmradion MultipathFilter::update_coeff().
  • Either volk_32fc_x2_s32fc_multiply_conjugate_add_32fc or volk_32fc_x2_s32fc_multiply_conjugate_add2_32fc of VOLK v3.1.0 did not work (no compilation error, but the calculation failed), in generic kernel (no CPU optimization) on airspy-fmradion MultipathFilter::update_coeff() running on Ubuntu 22.04.3 x86_64 compiled with gcc version 11.4.0. I had to fall back to VOLK 3.0.0, which worked OK. Also, airspy-fmradion compiled with VOLK 2.5.1 of Ubuntu 22.04.3's apt repository worked OK.

Workaround:

  • Use VOLK 3.0.0 or 2.5.2 for Ubuntu 22.04.3 (documented on airspy-fmradion 20231212-1)

Status:

I still don't know why the code works OK on macOS and fails on Ubuntu.
-> reason: macOS on Apple Silicon does not depend on the affected VOLK kernels (only using the polynomial or generic kernels) for volk_s32c_s32f_atan2_s32f().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.