I spent a bunch of time this past weekend working on my Radio Free Greenfield site. Now that Iâve got my album-ripping workflow back up and running and moved the storage to a bit more reliable piece of hardware, I decided to take on a project I had been thinking about since mid-summer.
The main focus of the site/service has been (and remains) listening to full albums. I donât want to get into arguments about the purity of the album as a format; it is my preference and albums constitute the vast majority of my music listening, but I am fully aware that is because albums are what I grew up with. If you have followed me for any amount of time, you have probably heard me say that different people can like different things and thatâs okay. If singles, EPs, or playlists are your bag, thatâs cool and I donât think youâre a bad person for it.
But I still prefer albums, and Radio Free Greenfield is my station and albums are mostly what I play on it.
Still, itâs not bad to change things up sometimes, right? With that in mind, I found myself thinking some months back that maybe I should see about occasionally streaming a mix of individual tracks. Seems straightforward; something any streaming tool can do. The challenge is that, because of the album-oriented nature of my station, I rip each CD to a single FLAC file, with a directory structure that has a directory per artist, with subdirectories per album within artist, and I was really not interested in also having additional files per track.
âBut,â I said to myself in a flash of brilliance, âEvery album FLAC is accompanied by a .flac.cue text file that lists the individula tracks on the album, their titles, and their start times! Could I not use those .cue files to generate playlists of songs pulled from the full album files?â
What then ensued was several daysâ worth of fiddling with shell scripts and queueing and all sorts of ffmpeg and Icecast fiddling, everying single bit of which resulted in stuttering, jumpy streams that skipped all over the place and were entirely unlistenable. And so I threw up my hands in a huff, reminding myself that I was really only interested in full-album streaming anyway, so I why was I even bothering with any of this?
Yesterday morning, though, flush off my success of moving all my files and fixing the CD-ripping workflow, I got to thinking about individual tracks again. Most of the problems I had the first time around seemed to stem from trying to do it all on the fly, so what if I parsed through all the .cue files at once, and stuffed the artist, album, and track info into a database, and then pulled from that?
So I gave it a shot, and unsurprisingly, it made the playlist generation part of the process much easier and more flexible. I started my first playlist stream, and it stalled after the first track finished and required a browser refresh to kick off the next track. No good! Turns out that even though my playlist streamer script was working and playing the next track on the list, Icecast was treating it as a new stream/session. On top of that, it took a very long time to even start the stream, as it was pre-rendering all tracks before starting.
The solution turned out to be two-fold: 1. Use a named pipe for the stream to hold the same Icecast session open (so that Icecast sees it as a single stream even though it was multiple tracks); and 2) Start the first track streaming as soon as it is rendered and then work on rendering the rest as they play. That solution fixed the stopping-after-each-track problem, and drastically reduced the amount of time between initiating a stream and having it actually start playing.
Those issues solved, I decided to keep things simple by having the playlist-streamer script stream to the same Icecast mount that the album-streamer uses. I donât get updated track info or album covers in the Now Playing widget on the RFG homepage that way, but thatâs fine. I dump the track listing into the Mastodon post for the stream, and that feels like enough to me.
There is a small bit of logic built into the playlist scriptâdonât pick multipe tracks from the same artist or album, keep track of what youâve already played and donât repeat, donât follow a super-long track with a really short oneâbut otherwise, I have left it pretty random. I am thinking about maybe adding some mood or genre options, but for now, I kind of like just letting it go and see what comes up.
I do zero monitoring or tracking of stats, other than some basic tx/rx monitoring to keep an eye out for bandwidth problems. I donât want to know what drives listeners; I donât care. I hope people are enjoying it, but even if itâs just me, I like the idea of casting my music collection out into the ether.