1

I have a live radio feed I am trying to capture using rtl_fm and SoX. The source comes in random bursts a few hours long with gaps of days or weeks between events. I would like to capture each of the events into its own audio file while disregarding the many hours of silence between events.

From the research I have done, the following should work.

‘rtl_fm -f _____0000 -M fm -s 24k -l 45 -p 0 -g 38 | sox -r 24k -e signed -b 16 -c 1 -V1 -t raw - ~/___/___/____Radio_Recording_$(date+%Y-%m-%d_%H:%M:%S).mp3 silence 1 0.1 0.1% 1 00:02:00 0.1% : newfile : restart ‘ 

It should start recording after 1/10th of a second of audio is detected, stop recording after 2 hours of unbroken silence, save the file, create a new file, and then start listening for audio again.

The problem is that it will not restart after the first file is saved. It waits for sound, records and saves the first file perfectly but it will not create a second file or restart recording. The only exception is if the wait period before it resets is exactly 1 second, at which point it will cycle as expected: waiting for sound, recording, saving, and restarting.

If you have any ideas why 1 second works and no other silence period, or ideas how to correct it, the help would be appreciated.

Or if you know a totally different way of automating this process that requires very little processing power, I am open to suggestions. In a test of concept I did use a GQRX-PulseAudio-Audacity setup but it used more system resources than I wanted to give it and wasn’t very automatic or user friendly to use.

0 Answers0