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 http://www.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 1024 -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 real time to a file named ftgws.wav. It will be a large file but don't worry, encoding to Ogg Vorbis will convert it down to about 140 megabytes. And now to do just that:
Converting to Ogg Vorbis
My preferred method of encoding is to the Open Source Ogg Vorbis format and there are several different ways to accomplish this. But, Gentle Reader, I give you the syntax for the easiest and most robust encoding by using oggenc. oggenc is part of the Vorbis Tools package and can be found in most Linux distros. Simply issue the following command:
$ oggenc -q 6 ftgws.wav \
-l "For the God Who Sings" \
-a "ABC Classic FM: Stephen Watkins" \
-d "`date +"%A %B %d, %Y."`" \
-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 Album, Artist and Date. 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 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/scripts:
#!/bin/sh
#-------------------------------------------------------------
# A very simple script to capture the Real Audio stream of:
# 'For the God Who Sings'
#-------------------------------------------------------------
# Changelog:
# February 6th 2008: Initial build capturing the delayed broadcast.
# May 26th 2008: Extensive rewrite and shift to capturing the live
# broadcast after the delayed broadcast proved somewhat unreliable.
# "Background" idea from http://www.linuxjournal.com/article/8171
#--------------------------------------------------------------
# All the variables:
DATE1=$(date +%d%m%Y)
DATE2=$(date +"%A %B %d, %Y.")
STREAM=http://www.abc.net.au/streaming/classic/classicfm.ram
DURATION=2.1h
MUSIC_DIR=$HOME/music
#-------------------------------------------------------------
cd $MUSIC_DIR
# Download the stream and convert it to wave format:
mplayer -cache 1024 -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, place the tags, normalise:
oggenc -q 6 ftgws.wav \
-l "For the God Who Sings" \
-a "ABC Classic FM: Stephen Watkins" \
-d "$DATE2" \
-o ftgws_$DATE1.ogg
vorbisgain ftgws_$DATE1.ogg
#-------------------------------------------------------------
# Clean up:
rm $MUSIC_DIR/ftgws.wav
The script is run from cron as follows:
# Runs the ftgws_download.sh script every Sunday: 27 22 * * sun /home/andrew/scripts/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?