A Python 3 script for capturing and recording a SDR stream to a WAV file (or serving it to a HTTP audio stream).

Related tags

Audio rfsoapyfile
Overview

rfsoapyfile

A Python 3 script for capturing and recording a SDR stream to a WAV file (or serving it to a HTTP audio stream). The script is threaded for high performance, especially on a Raspberry Pi. The script includes a REST API for controlling the capture and WAV recording remotely.

The script will save the stream in either RF64 or WAV file format. By default the recording uses the WAV format. The SDR specific 'auxi' metadata chunk is added to the file as well.

Dependencies

The script requires the numpy and SoapySDR Python libraries.

Example

$ python soapyfile.py -f 100.1e6 -r 1e6 --pcm16 -g 42 --output out --pause

Usage

$ soapyfile.py --help
usage: soapyfile.py [-h] [-l] [-d DEVICE] [-f FREQUENCY] [-r RATE] [-g GAIN]
                    [-a] [--iq-swap] [--biastee] [--digital-agc]
                    [--offset-tune] [--direct-samp DIRECT_SAMP] [--pcm16]
                    [--rf64] [--notimestamp] [--pause] [--output OUTPUT]
                    [--packet-size PACKET_SIZE] [--buffer-size BUFFER_SIZE]
                    [--hostname HOSTNAME] [--port PORT] [--refresh REFRESH]
                    [--quiet]

optional arguments:
  -h, --help            show this help message and exit
  -l, --list            list devices (default: False)
  -d DEVICE, --device DEVICE
                        device name (default: None)
  -f FREQUENCY, --frequency FREQUENCY
                        center frequency (Hz) (default: None)
  -r RATE, --rate RATE  sampling rate (Hz) (default: None)
  -g GAIN, --gain GAIN  front end gain (dB) (default: None)
  -a, --agc             enable AGC (default: False)
  --iq-swap             swap IQ signals (default: False)
  --biastee             enable bias tee (default: False)
  --digital-agc         enable digital AGC (default: False)
  --offset-tune         enable offset tune (default: False)
  --direct-samp DIRECT_SAMP
                        select I or Q channel: 1 or 2 (default: None)
  --pcm16               write 16-bit PCM samples (default: False)
  --rf64                write RF64 file (default: False)
  --notimestamp         do not add timestamp to filename (default: False)
  --pause               pause recording (default: False)
  --output OUTPUT       output file name (default: output)
  --packet-size PACKET_SIZE
                        packet size (default: 1024)
  --buffer-size BUFFER_SIZE
                        buffer size in MB (default: 256)
  --hostname HOSTNAME   REST server hostname (default: 0.0.0.0)
  --port PORT           REST server port number (default: 8080)
  --refresh REFRESH     peak meter refresh (sec) (default: 2)
  --quiet               do not print peak values (default: False)

REST API

The REST API is available off port 8080. Use POST or PUT to change a program or radio setting. Use GET to view it. If a boolean is needed, the following strings are accepted: y, n, yes, no, true, and false.

PUT /quit              
   
          stop recording and terminate program, yes or no
PUT /rate              
    
          set sampling rate (Hz) but only if recording is paused
PUT /frequency         
     
           set center frequency (Hz)
PUT /gain              
      
            set gain (dB)
PUT /agc               
       
         enable agc, yes or no PUT /pause 
        
          pause recording, yes or no PUT /setting/
          
          
            change named soapy setting GET /rate return sampling rate (Hz) GET /frequency return center frequency (Hz) GET /gain return gain (Hz) GET /agc return AGC setting (yes or no) GET /pause return whether the recording is paused (yes or no) GET /setting return list of available soapy setting names GET /setting/
           
             return value of named soapy setting GET /s16 return 16-bit integer PCM WAV HTTP audio stream GET /f32 return 32-bit floating point PCM WAV HTTP audio stream 
           
          
         
        
       
      
     
    
   
You might also like...
Make an audio file (really) long-winded

longwind Make an audio file (really) long-winded Daily repetitions are an illusion anyway.

Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files according to their common names

Batch Sorting Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files accord

A rofi-blocks script that searches youtube and plays the selected audio on mpv.
A rofi-blocks script that searches youtube and plays the selected audio on mpv.

rofi-ytm A rofi-blocks script that searches youtube and plays the selected audio on mpv. To use the script, run the following command rofi -modi block

Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.

Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.

:speech_balloon: SpeechPy - A Library for Speech Processing and Recognition: http://speechpy.readthedocs.io/en/latest/
:speech_balloon: SpeechPy - A Library for Speech Processing and Recognition: http://speechpy.readthedocs.io/en/latest/

SpeechPy Official Project Documentation Table of Contents Documentation Which Python versions are supported Citation How to Install? Local Installatio

C++ library for audio and music analysis, description and synthesis, including Python bindings

Essentia Essentia is an open-source C++ library for audio analysis and audio-based music information retrieval released under the Affero GPL license.

An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio.

yt-dl (GUI Edition) An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio. How do I download this? Windows: Fi

Audio fingerprinting and recognition in Python
Audio fingerprinting and recognition in Python

dejavu Audio fingerprinting and recognition algorithm implemented in Python, see the explanation here: How it works Dejavu can memorize audio by liste

Python library for audio and music analysis

librosa A python package for music and audio analysis. Documentation See https://librosa.org/doc/ for a complete reference manual and introductory tut

Comments
  • No audio in HTTP audio stream and WAV stream

    No audio in HTTP audio stream and WAV stream

    Hi, I'm trying this awasome project, but I can't listen to anything. Peak values is working, but no audio inside HTTP and WAV stream, just silence. If I try a wrong sampling rate I can ear rustling. Any ideas to solve this problem? Thanks

    Matteo

    opened by mpeirone 0
Owner
null
Library for working with sound files of the format: .ogg, .mp3, .wav

Library for working with sound files of the format: .ogg, .mp3, .wav. By work is meant - playing sound files in a straight line and in the background, obtaining information about the sound file (author, performer, duration, bitrate, and so on). Playing goes through the pygame, and getting information through the mutagen.

Romanin 2 Dec 15, 2022
This bot can stream audio or video files and urls in telegram voice chats

Voice Chat Streamer This bot can stream audio or video files and urls in telegram voice chats :) ?? Follow me and star this repo for more telegram bot

WiskeyWorm 4 Oct 9, 2022
cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python

audioread Decode audio files using whichever backend is available. The library currently supports: Gstreamer via PyGObject. Core Audio on Mac OS X via

beetbox 419 Dec 26, 2022
cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python

audioread Decode audio files using whichever backend is available. The library currently supports: Gstreamer via PyGObject. Core Audio on Mac OS X via

beetbox 359 Feb 15, 2021
convert-to-opus-cli is a Python CLI program for converting audio files to opus audio format.

convert-to-opus-cli convert-to-opus-cli is a Python CLI program for converting audio files to opus audio format. Installation Must have installed ffmp

null 4 Dec 21, 2022
Audio spatialization over WebRTC and JACK Audio Connection Kit

Audio spatialization over WebRTC Spatify provides a framework for building multichannel installations using WebRTC.

Bruno Gola 34 Jun 29, 2022
Audio augmentations library for PyTorch for audio in the time-domain

Audio augmentations library for PyTorch for audio in the time-domain, with support for stochastic data augmentations as used often in self-supervised / contrastive learning.

Janne 166 Jan 8, 2023
praudio provides audio preprocessing framework for Deep Learning audio applications

praudio provides objects and a script for performing complex preprocessing operations on entire audio datasets with one command.

Valerio Velardo 105 Dec 26, 2022
BART aids transcribe tasks by taking a source audio file and creating automatic repeated loops, allowing transcribers to listen to fragments multiple times

BART (Beyond Audio Replay Technology) aids transcribe tasks by taking a source audio file and creating automatic repeated loops, allowing transcribers to listen to fragments multiple times (with possible overlap between segments).

null 2 Feb 4, 2022
Hide Your Secret Message in any Wave Audio File.

HiddenWave Embedding secret messages in wave audio file What is HiddenWave Hiddenwave is a python based program for simple audio steganography. You ca

TechChip 99 Dec 28, 2022