BashTalkRadio


Page Created: 7/30/2014   Last Modified: 3/18/2016   Last Generated: 12/11/2017

Years ago, I created a Linux and Bash shell based time-shifting script to record some live AM and shortwave talk radio shows so I could listen to them later, especially the ones that came on late at night when I was asleep. It worked in conjunction with the IdThreePlugin so that I could just click on a show to play it. While USB FM tuners were widely available and inexpensive, the longer-wavelength, amplitude modulation computer tuners were harder to find and more expensive. So I simply connected the audio earphone or headphone output of an AM/shortwave radio into the sound card line-in input (carefully setting the volume to avoid clipping).

I originally got my inspiration from an older, similar project↗ that uses TCL, but I wrote mine from scratch using Bash and included a download/tagging function.

I took it offline to change the audio codec from mp3 to the Xiph.Org Foundation's Opus↗, but it was so new at the time that a lot of tools, especially those for Opus metadata tagging, did not support it. I eventually had to write my own command-line "shim" program using Python and Mutagen↗ to get this functionality and have since been waiting for Vorbiscomment to support it. Opus is a free and open, flexible and efficient codec that is ideal for compressing talk radio shows. Most shows are an hour or more in length, and Opus can scale down to bitrates of 6 Khz and still deliver intelligible voice. It can also scale up for high-fidelity audio, such as FM wideband.

I have since adapted the script to record from several audio sources (line-in/mic, RTL2832U software-defined radio, and Internet streams), but haven't decided to release the new version yet. I am trying to integrate it into my PacketRadio interface to control the UV-5R series of radio to record amateur radio nets↗, since the nets near me are weekly or monthly, which are easy to miss and not available via podcast.

One interesting feature about the PacketRadio interface is that the radio can be remotely turned on, off and the frequency changed. So before a show or net, the radio turns on, tunes to the frequency, the show is recorded, compressed, and tagged, and the radio is turned off. But at the time of this writing in 2016, the Chirp programming software seems to be GUI (graphical) only, and I cannot find a small, reliable program that will control this function from Linux command-line arguments. The Chirp source code is open, but I would have to write some more custom Python code to control it from the command line, which is time consuming. The RTL2832U device is much easier to control thanks to good command-line tools like rtl_fm, but I wanted to integrate automated frequency control into the UV-5RA.

Comments