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; perhaps you will follow me down this same path?

Every Sunday night at 2200hrs Stephen Watkins hosts a 2 hour radio show that presents "music and texts that seek to enlighten the path untravelled, the idea unravelled". Following the iconic introduction of Arvo Pärt's 'Cantus in Memoriam Benjamin Britten' Stephen's beautiful and quietly contemplative voice introduces and expands on sacred music for 2 peaceful hours. The music echoes the title of the radio presentation as it speaks of God, with words from Zephaniah 3:14-17, 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 crontab, FFmpeg, eyeD3 and AtomicParsley you can download the live stream of "For the God Who Sings" in a format suitable for offline playback on any computer, smart phone or similar playback device. A perhaps unusual 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 that have a recent copy of FFmpeg and eyeD3. However I will share a few tips and tricks that will hopefully make the whole process a little easier, so that you will not have to struggle, as I initially did, to get it all set up and running smoothly.

Finding the stream...

ABC have the URIs of their live radio streams here and I thank Kat from the ABC for pointing me to this address! For my purposes I use the mp3 stream because it sounds better on my playback devices; for this a simple 'copy' will suffice. A bigger bitrate or a lossless stream would be better to work with but neither of these are available.

Scripting the stream...

The real magic of course lies in capturing the stream live as it is actually broadcast and I have developed a small script to do this for me automagically every Sunday night between 2159hrs and 0001hrs. This contains a 1 minute 'sneeze' factor before and after the 2 hour broadcast. I have named the following script ftgws_download.sh and it lives in /home/andrew/bin:

#!/bin/sh
#---------------------------------------------------------------#
#  A very simple script to capture the live radio broadcast of: #
#               'For the God Who Sings'                         #
#  Tested with FFmpeg N-102841-g041267b558 and eyeD3 0.9.6      #
#---------------------------------------------------------------#

# All of the variables:
DATE=$(date +"%Y-%m-%d")
STREAM=https://live-radio01.mediahubaustralia.com/2FMW/mp3/

DURATION=02:02:00.00
MUSIC_DIR=$HOME/ssd2/ftgws/

# Set some unusual paths on my system, not found by user crontab:
#   1. FFmpeg is a local copy, apart from a system installation.
#   2. eyeD3 is also a local copy, installed by pipx.
FFMPEG=/home/andrew/bin/ffmpeg
EYED3=/home/andrew/.local/bin/eyeD3

cd $MUSIC_DIR

# Download the stream and save / copy in mp3 format:
$FFMPEG -i $STREAM -t $DURATION -c copy ftgws_$DATE.mp3

# Set some tags in place as well as embed a decent cover art image:
#    https://id3.org/id3v2.4.0-frames
#    https://www.andrews-corner.org/downloads/ftgws_300x300.jpg
      
$EYED3 --remove-all \
       --artist "Stephen Watkins" \
       --album-artist "Various" \
       --album "For the God Who Sings" \
       --track 1 \
       --track-total 1 \
       --title "Ftgws $DATE" \
       --genre "Classical" \
       --recording-date "$DATE" \
       --add-image "ftgws_300x300.jpg:FRONT_COVER" \
       --add-comment "Thanks to ABC Classic FM & Stephen Watkins..." \
       --text-frame TENC:"Andrew Strong" \
       --url-frame WORS:"http\\://www.abc.net.au/classic/program/forthegodwhosings/" \
       ftgws_$DATE.mp3  

echo "Start listening to: ftgws_$DATE.mp3!!" | mailx -s "For the God Who Sings..." \
      andrew.david.strong@gmail.com

The script is run from cron as follows (after running crontab -e as an ordinary user):

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

So all that remains now is for you to open up your favourite command line player mpg123 or mpv, or simply Bluetooth the file onto your smartphone as I do, and then sit back and prepare to be enchanted for two beautiful hours as you listen to "For the God Who Sings" with Stephen Watkins.

And if this fails...

If for whatever reason the capture of the live stream fails it is still possible to catch the archived copy, which is available as an HLS stream for 28 days. This AAC stream has been harnessed into the small script below which has reliably worked for me for some years now.

Note that ABC ClassicFM appears to simply alter the naming convention each week for its archived and streamable files using the filename convention 'fgs-YYYY-MM-DD.m4a', meaning that you can simply alter the filename in the stream to download the newer or older archived programs. I have created a simple script that will accomplish this that only requires the filename to be altered each week to download a new archive. Note that this time AtomicParsley will be used to tag the output file:

#!/bin/sh
#---------------------------------------------------------------#
#  A simple script to capture the archived radio broadcast of:  #
#               'For the God Who Sings'                         #
#     FFmpeg N-102841-g041267b558 and AtomicParsley 20210715    #
#---------------------------------------------------------------#

# The date variable must be adjusted each week in the format: YYYY-MM-DD
DATE=2021-10-03

STREAM=https://abcradiomodhls-vh.akamaihd.net/i/classic/audio/fgs-$DATE.m4a/master.m3u8
MUSIC_DIR=$HOME/ssd2/ftgws/

# Set some unusual paths on my system:
#   1. FFmpeg is a local copy, apart from a system installation.
#   2. AtomicParsley is also a local copy, installed manually.
FFMPEG=/home/andrew/bin/ffmpeg
ATOMIC=/home/andrew/bin/AtomicParsley

cd $MUSIC_DIR

$FFMPEG -i $STREAM -bsf:a aac_adtstoasc -c copy ftgws-$DATE.m4a

# Set some tags in place as well as embed a decent cover art image:
#    https://www.andrews-corner.org/downloads/ftgws_300x300.jpg

$ATOMIC ftgws-$DATE.m4a \
        --artist "Stephen Watkins" \
        --album "For the God Who Sings" \
        --albumArtist "Various" \
        --title "ftgws $DATE" \
        --genre "Classical" \
        --artwork ftgws_300x300.jpg \
        --overWrite

Some work still to do on this little script but this is the sort of work and research I enjoy! For the moment that is a task for another day and I am going to settle back now and listen to this glorious music one more time, perhaps you should as well?