Radio Free Conductor

I got this idea from Dave, one of the engineers on our application team. It was during his interview, actually — we were talking about the time we’d both spent in the game industry, how the hours and work were crazy but that the culture at game development companies is fun and inventive. He told me about a system they’d set up at his old job where people could DJ music to a group of co-workers such that everybody could listen to the same curated stream of music at the same time. It sounded really fun, and I was so impressed that Dave had built it that I recommended we hire him right away. (After bringing this up with him recently for the purposes of writing this blog post, I realized that I’d been confused and that he was just talking about turntable.fm — which he didn’t build, but which is plenty cool in its own right. Luckily, Dave turned out to be a great engineer, so I feel pretty good about the whole thing.) I decided that the Conductor engineering team should have a similar setup, and resolved to build it. The result is an intranet radio server cobbled together from Free Software components and commodity hardware that “broadcasts” Radio Free Conductor, a playlist of my personal MP3s . The instructions below will help you set your own stations.

1. Find a machine to be your office radio server.

This is the server that people who want to listen to your radio station will be connecting to. You’ll want something inside the firewall and inside your server closet so that it’s visible to everyone on the office network but not the Internet at large.

2. Install a copy of Icecast on your radio server.

http://www.icecast.org/download.php

Icecast is a streaming media server that implements AOL’s SHOUTcast protocol. You’ll be using to broadcast the audio stream for your station to the listeners connected to the radio server. If you’re running Debian on your radio server or using MacPorts for OS X, you can install Icecast via the icecast2 package. Icecast runs as a daemon process, which you can control with an init script. To start it, run

/etc/init.d/icecast2 start

You can verify that it’s running by visiting
http://radio:8000/ in your browser, where radio is the hostname of your radio server.

3. Find a machine to be your station.

This is the machine you’ll be using to stream your playlist to the radio server. Obviously, your station will only be up while this machine is connected to the server, so a laptop might not be a great fit. I’ve been using an old Mac Mini that I run headless with just a power cable, an Ethernet cord, and my USB drive hooked up to it.

4. Install a copy of Ezstream on your station.

http://www.icecast.org/ezstream.php

Ezstream is a SHOUTcast client that you’ll be using to stream your playlist to the radio server from your station. If you’re running Debian on your station machine or using MacPorts for OS X, you can install Ezstream via the ezstream package.

5. Create your playlist.

Ezstream supports a variety of formats (e.g., Ogg Vorbis and FLAC) but it’s probably easiest to get up and running with MP3s. Your radio station’s playlist is just a text file with a list of your MP3 filenames, one path per line. You can create it pretty easily by doing a recursive search of the directory tree where you keep your music files:

find "/Volumes/Music HD" —name "*.mp3" > mp3s.txt

Here’s an excerpt from mine:

/Volumes/Music HD/AB'S/6 - Concrete Hits Bone.mp3
/Volumes/Music HD/Abrasive Wheels/16 - Burn 'Em Down.mp3
/Volumes/Music HD/Angelic Upstarts/3 - I Won't Pay For Liberty.mp3

6. Configure your station.

Ezstream uses an XML configuration file format to describe a stream. Here’s an example (ezstream.xml) from Radio Free Conductor, the station that I run off my MP3 hard drive:

<ezstream>
  <url>http://radio:8000/crfc</url>
  <sourcepassword>password</sourcepassword>
  <format>MP3</format>
  <filename>mp3s.txt</filename>
  <shuffle>1</shuffle>
  <svrinfoname>Radio Free Conductor</svrinfoname>
  <svrinfourl>http://radio:8000/crfc</svrinfourl>
  <svrinfogenre>Weird Rock Music</svrinfogenre>
  <svrinfodescription>This is my playlist.</svrinfodescription>
</ezstream>

The “url” element gives the address (including the path, or “mount point”) to which your stream should be sent. In the case above, “crfc” is the mount point for my station. The “shuffle” element tells Ezstream to randomize the order of the songs listed in the file given by the “filename” element. The “svr*” elements allows you to provide some metadata about the stream, which will be displayed to people who browse the Icecast web interface or connect with a SHOUTcast client.

7. Start the stream, and wonder why your co-workers prefer Spotify over your extensive collection of obscure 1970s punk music.

ezstream -c ezstream.xml

Anyone with an audio player (such as VLC or iTunes) capable of reading an MP3 stream can tune in by connecting to your configured mount point. That’s it. Enjoy!

About Julian Graham

Julian Graham is an engineering manager at Conductor. He leads the infrastructure team, which focuses on collecting, analyzing, and storing all of the data that powers Searchlight.

Related Posts