# My new Radio VCR

Posted on
Tags:

I like to listen to NPR, but I often miss interesting shows. So I decided to make a VCR for radio. That way I can record shows and listen to them at my leisure.

I started by taking an old radio and connecting its headphone output to one of my server’s audio-in jacks w/ a 6-foot 1/8Stereo plug to 1/8" Stereo plug Cord from Radio Shack. Then I installed the “Advanced Linux Sound Architecture on the server because it has better support for the server’s built-in audio chip (CS4236B).

Playing around for a while, I managed to get decent recordings to WAV format. Since WAVs are rather large (about 200 MB/hr at the settings I was using) I tried re-encoding the recordings as Ogg Vorbis in various bitrates, but ultimately settled on Speex, which is much better at compressing speech. Final file sizes are about 10 MB/hr, which is fine considering my hard-drive space.

Next, I wrote a small shell script to record a show, compress it, and store it in a library:

#!/bin/bash

# Simple script to record a radio show and save as a Speex-encoded file
# Tom Moertel
# 20 Feb 2004
#
# Usage: record-show

#
# Recordings are saved in the following directory structure:
#
# ~/recordings//2004/02/--2004-02-19--Thu--2359.spx
#
# Directories are created as needed.

# Check arguments.

if [ -z "$1" ]; then echo 'Usage: record-show show-name show-duration-in-seconds' exit 1; fi # Set up definitions for use later show_base="$HOME/recordings"
show="${1:-recording}" duration="${2:-3600}"
year=$(date +%Y) month=$(date +%m)
now="$(date +%F--%a--%H%M)" showdir="$show_base/$show/$year/$month" showfile="$showdir/$show--$now.spx"

# Make directory to contain the show recording (if necessary)

mkdir -p "$showdir" >&/dev/null # Record the show and exit with the exit status of speexenc arecord -q -d$duration -c2 -r16000 -f S16_LE |
speexenc --vbr --vad --dtx - "$showfile" >&/dev/null exit$?


Finally, I programmed my “Radio VCR” to record any potentially interesting shows that are broadcast by my local NPR affiliate. This was simple using my script above and the following crontab:

00 06 * * 1-5           record-show morning-edition         3600
00 12 * * 1-5           record-show day-to-day              3600
00 15 * * 1-5           record-show fresh-air               3600
00 17 * * 1-5,6-7       record-show all-things-considered   3600
30 18 * * 1-5           record-show marketplace             1800

00 08 * *     6-7       record-show weekend-edition         3600
00 10 * *     6         record-show car-talk                3600
00 10 * *       7       record-show studio-360              3600
00 11 * *     6         record-show whad-ya-know            7190
00 13 * *     6         record-show wait-wait-dont-tell-me  3600
00 15 * *       7       record-show this-american-life      3600
00 16 * *       7       record-show splendid-table          3600


All in all, this has turned out to be a great hack - simple, fun, and useful.

comments powered by Disqus