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?
Setting up mplayer
Firstly you will need the Linux "Swiss Army Knife" of movie players: mplayer. It is a bit of work to install mplayer but well worth it for your media needs in general. First to download the full codec pack and then place the these codecs in the appropriate location:
$ mkdir -v $HOME/source $ cd $HOME/source $ wget ftp://ftp.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2 $ tar xjvf all-20071007.tar.bz2 $ su # mkdir -v /usr/lib/codecs # cp -v all-20071007/* /usr/lib/codecs
The next task is to download the source code for the subversion mplayer and then compile this source code:
$ cd $HOME/source
$ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
$ cd mplayer
$ ./configure \
--prefix=/usr \
--mandir=/usr/man \
--confdir=/etc/mplayer \
--codecsdir=/usr/lib/codecs
$ make
$ su
# make install
This compilation excludes the gui Gmplayer which I personally do not use. After the long compile process the final step is to place a font for the OSD (On Screen Display) and subtitles:
$ mkdir -v $HOME/.mplayer/ $ ln -sv /usr/share/fonts/TTF/DejaVuSerif.ttf $HOME/.mplayer/subfont.ttf
And you have successfully installed mplayer! mplayer is a truly amazing program and I encourage you to comprehensively explore it. But now for our radio broadcast, the beautiful "For the God Who Sings":
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 FLAC will drop it down to about 450 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
This actually becomes second nature after you type it out a few times and don't forget: let tab-completion be your friend. The tagging options I have given will give you tags for Title, Album and Artist. The filename I propose is of course simply the date of encoding. But 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
#-------------------------------------------------------------
# Changelog:
# Feb 06 2008: Initial build capturing the delayed broadcast.
# May 26 2008: Shift to capturing the live broadcast.
# Nov 10 2008: Corrected Ogg Vorbis tags.
# Dec 01 2008: Used SoX to adjust the volume.
# Apr 27 2009: Transcoding to FLAC instead of Ogg.
# Jun 14 2009: Back to Ogg and dropped SoX.
# 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?