1. Andrew's Corner :

Slackware and "For The God Who Sings"

In this page I have attempted to combine my love of an amazing radio broadcast called "For the God Who Sings" with my passion for Linux. Perhaps an uneasy mix in the eyes of many but humour me, Gentle Reader, and read the entire page and perhaps you will follow me down this same path? Every Sunday night at 10.30 pm Stephen Watkins hosts a 2 hour radio show that presents "music and texts that seek to enlighten the path untravelled, the idea unravelled". Stephen has a beautiful and quietly contemplative voice that complements perfectly the sacred music that he introduces. And yes, the music echoes the title of the radio presentation as it speaks of God in an exultation of song:

Sing aloud, O daughter Zion; shout, O Israel! Rejoice and exult with all your heart, O daughter Jerusalem! The LORD has taken away the judgements against you, he has turned away your enemies. The king of Israel, the LORD, is in your midst; you shall fear disaster no more. On that day it shall be said to Jerusalem: Do not fear O Zion; do not let your hands grow weak. The LORD, your God, is in your midst, a warrior who gives you victory; he will rejoice over you with gladness, he will renew you in his love; he will exult over you with loud singing as on a day of festival.

But can I say for all this it is way past my bedtime!! So on this page I will demonstrate how with mplayer and oggenc you can download the Real Audio stream of "For the God Who Sings", save it offline and then convert it to a suitable audio format for later playback. A perfect mix of religious music and modern technology?

Slackware 13 & MPlayer

Times have changed a little for Slackware and perhaps you will no longer need to compile the newest version of MPlayer because as of release 13.0 there is now a quite capable version of the svn MPlayer available in the xap series. Certainly you would be well advised to run the Slackbuild script again and pass USE_PATENTS=YES to the script if this is legal in your country but otherwise your copy of MPlayer is more than ready to tackle this Real Audio stream.

Saving the Real Audio Stream

For the first step go to the ABC Classic FM web site and find the address of the current Real Audio broadcast of "For the God Who Sings", copy it and paste it into the command below, substituting the actual address for <address.ram>:

$ mplayer -cache 2048 -bandwidth 1000000 -playlist <address.ram> \
          -vc null -vo null -ao pcm:fast:waveheader:file=ftgws.wav

The 2 hour stream will then be saved to your computer in about 30 minutes, courtesy of the -bandwidth option that I have only just started experimenting with, to a file named ftgws.wav. It will be a file of about 1.2 gig but don't worry, transcoding to Ogg Vorbis will drop it down to about 130 megabytes. And now to do just that:

Converting to Ogg Vorbis

I transcode the stream to Ogg Vorbis because of my love for this Open Source format and because I usually play the stream back on my iRiver X20 which features native Ogg Vorbis playback. To transcode to Ogg and tag at the same time simply issue the following command:

$ oggenc -q 6 ftgws.wav \
         -t "For the God Who Sings" \
         -l "ABC Classic FM Radio Broadcasts" \
         -a "Stephen Watkins" \
         -o ftgws_$(date +"%d%m%Y").ogg 

The filename given here of course represents the date and time of encoding rather than the date of broadcast so perhaps you might like to pop the actual broadcast date in here? The tagging options I have given will give you tags for Title, Album and Artist. As a postscript to this some may be interested to know that I have been experimenting a little with neroAacEnc to produce high quality aac sound from the broadcast:

$ neroAacEnc -q 0.65 -if ftgws.wav -of ftgws_$(date +"%d%m%Y").mp4 && \
             neroAacTag ftgws_$(date +"%d%m%Y").m4a\
             -meta:artist="Stephen Watkins" \
             -meta:album="ABC Classic FM Radio Broadcasts" \
             -meta:title="For the God Who Sings" 

This is a little rough as yet and I am not entirely convinced that the sound quality is all that superior to the Ogg Vorbis playback on my computer at least, but I shall continue to experiment while I should be doing other things. As for Ogg Vorbis there is a better way to do all this with the use of a script and below is my "work in progress", a script to automatically download and convert the live audio stream every Sunday night:

Scripting the Stream

I can tell you for free Gentle Reader that I have no special skills with scripting but I learn fast and eventually this script will look a little cleaner. I have named the script ftgws_download.sh and it lives in /home/andrew/bin:

#!/bin/sh
#-------------------------------------------------------------
#  A very simple script to capture the Real Audio stream of:
#             'For the God Who Sings'
#  Tested with the svn Mplayer and oggenc 1.2.0
#-------------------------------------------------------------

# Most of the variables:

DATE1=$(date +"%d%m%Y")
DATE2=$(date +"%d-%m-%Y")
STREAM=http://www.abc.net.au/streaming/classic/classicfm.ram
DURATION=2.2h
MUSIC_DIR=$HOME/music/ftgws

#-------------------------------------------------------------

cd $MUSIC_DIR

# Download the stream and convert it to wave format:

mplayer -cache 2048 -playlist $STREAM \
        -vc null -vo null -ao pcm:fast:waveheader:file=ftgws.wav &

sleep $DURATION # Length of the program being recorded as background. 
kill $!         # End the most recently backgrounded job = mplayer

# Convert to ogg format and place the appropriate tags:

oggenc -q 6 ftgws.wav \
         -t "For the God Who Sings: $DATE2" \
         -l "ABC Classic FM Radio Broadcasts" \
         -a "Stephen Watkins" \
         -o ftgws_$DATE1.ogg 

#-------------------------------------------------------------
# Clean up:

rm ftgws.wav

The script is run from cron as follows:

# Runs the ftgws_download.sh script every Sunday:                               
25 22 * * sun /home/andrew/bin/ftgws_download.sh

This little script is still in its infancy and I will return to this page in the near future to develop it a little more. But in the meantime has the file finished encoding? Well, open up your command line player ogg123, mplayer or whatever you choose, sit back and prepare to be enchanted for 2 beautiful hours as you listen to "For the God Who Sings" with Stephen Watkins.

And in conclusion ...

I have found immense enjoyment in writing this page and my pleasure will be redoubled if you have profited by any of the material on this page. Send me an email and let me know! Importantly I am still having a great and productive time in the world of Linux and I feel as if I have joined a community and am contributing to it. What about you?