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 often way past my bedtime!! So on this page I will demonstrate how with the svn MPlayer and and the mp3 encoder Lame you can download the live stream of "For the God Who Sings" and then convert it to mp3 format for offline playback on computer, smart phone or in my case: iPOD Classic. A perhaps precarious mix of religious music and modern technology?
All the steps...
Downloading and converting the live stream for "For The God Who Sings" can be easily done from within most modern Linux distros but I will share a few tips and tricks that will hopefully make the whole process a little easier:
MPlayer & Lame...
Times have changed a little for Slackware and perhaps you will no longer need to compile the newest version of MPlayer, as I have advocated before, because as of release 13.0 there is now a quite capable version of the svn MPlayer available in the Slackware 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 legally allowable in your country, and perhaps also add the MPlayer codecs to your system but otherwise the default copy of MPlayer is more than ready to tackle this stream. For Ubuntu users there is always my guide for building the latest MPlayer and I would advise following this route rather than using an aged copy from the Ubuntu Repository. There should be no problem getting access to Lame which under Slackware needs to be compiled and installed and perhaps this is best done with a script from Slackbuilds.org.
Finding the stream...
ABC ClassicFM has changed their web site and also their streaming method over the last few months, making life a little more difficult! There are still copies of older broadcasts of "For The God Who Sings", for download although the links are often a little unreliable, and the main live ABC ClassicFM broadcast is now a 64k aac rtmp stream. The direct url for the stream can be found with WireShark, as I have done, and this can be played back as follows:
rtmpdump -r "rtmp://cp112896.live.edgefcs.net/live/classic_fm@40676" \ --swfVfy "http://www.abc.net.au/res/players/aacPlayer.swf" \ --pageUrl "http://www.abc.net.au/classic/player/" \ --live --verbose --timeout 240 -o - | mplayer -cache 2048 -
But connection with rtmpdump to this stream is more than a little precarious and I would not trust it for downloading a 2 hour stream. The alternative is unfortunately a Windows-specific link which nevertheless runs much more reliably than the rtmp stream:
mplayer -playlist "http://abc.net.au/res/streaming/audio/windows/classic_fm.asx"
There are several other streams to choose from but the ABC people have requested the two streams above be used so I am trying to be a good citizen about the whole thing and thus this is the stream we will use!
Scripting the stream...
The real magic of course lies in actually capturing the stream live as it is broadcast and I have developed a small script to do this for me automatically every Sunday night between 2225hrs and 0035hrs (this contains a 5 minutes 'sneeze' factor before and after the 2 hour broadcast). I have named the following script
ftgws_download.sh and it lives in
#!/bin/sh #--------------------------------------------------------------- # A very simple script to capture the live radio broadcast of: # 'For the God Who Sings' # Tested with the svn Mplayer and Lame 3.99.5 #--------------------------------------------------------------- # Most of the variables: DATE=$(date +"%Y-%m-%d") YEAR=$(date +"%Y") STREAM=http://abc.net.au/res/streaming/audio/windows/classic_fm.asx DURATION=130m MUSIC_DIR=$HOME/media/ftgws #------------------------------------------------------------- cd $MUSIC_DIR # Download the stream and convert it to wave format: mplayer -cache 16384 -cache-min 80 -playlist $STREAM \ -vc null -vo null -ao pcm:fast:waveheader:file=ftgws_$DATE.wav & sleep $DURATION # Length of the program being recorded as background. kill $! # End the most recently backgrounded job = mplayer # Convert to mp3 format, place the appropriate tags and add some album art. # I use the following image of Stephen Watkins: # http://www.andrews-corner.org/images/ftgws_album.jpg lame -V 3 --vbr-new \ --tt "$DATE" \ --tl "For the God Who Sings" \ --ta "Stephen Watkins" \ --ty "$YEAR" \ --tg "Classical" \ --ti "ftgws_album.jpg" \ --tc "http://www.abc.net.au/classic/" \ ftgws_$DATE.wav ftgws_$DATE.mp3 #------------------------------------------------------------- # If wishing to automatically delete the source wav file uncomment the following: # rm ftgws_$DATE.wav
The script is run from cron as follows (after running
crontab -e as an ordinary user):
# Runs the ftgws_download.sh script every Sunday: 25 22 * * sun /home/andrew/bin/ftgws_download.sh
So all that remains is for you to open up your favourite command line player mpg123, 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 if there is a problem....
At times there may be a network vagary and if capture of the live stream fails the entire show can be downloaded and converted for the next few weeks with the following copy and paste single command:
mplayer -cache 16384 -cache-min 80 -bandwidth 1000000 \ -playlist http://www.abc.net.au/classic/xml/audio/fgs-YYYY-MM-DD.asx \ -vc null -vo null -ao pcm:fast:waveheader:file=ftgws_YYYY-MM-DD.wav && \ lame -V 3 --vbr-new \ --tt "YYYY-MM-DD" \ --tl "For the God Who Sings" \ --ta "Stephen Watkins" \ --ty "2014" \ --tg "Classical" \ --ti "ftgws_album.jpg" \ --tc "http://www.abc.net.au/classic/" \ ftgws_YYYY-MM-DD.wav ftgws_YYYY-MM-DD.mp3 && \ rm ftgws_YYYY-MM-DD.wav
And of course do a little "Find and Replace" to insert the correct dates to capture the relevant stream. It is not nearly as exciting as catching the live stream but sometimes it is necessary and the music sounds the same!
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?