What I Want
Since I bought my (replacement) iPod in May I’ve become curious about the possibility of streaming music from my laptop over the network and into my iPod. Apple doesn’t natively permit this function to occur with shared iTunes libraries – but neither do they discourage people from writing their own apps. There’s dozens of music streaming applications available in the iTunes Store; apps such as Pandora, last.fm, and NPR Music are all hugely popular, to name just three.
However, the majority of available music streaming apps only stream their content; their news channels, music, shows and podcasts. I really wanted the capability of stream my own music collection over the network from a given box and onto my iPod. It isn’t a question of having more music than I do hard disk space on my iPod (22gb versus 8gb); I don’t listen to a whole lot of music at one time. I would just like the capability for the sake of having it.
The Dreadful Alternatives™
My first attempts to stream over the network were using two Windows applications: Airfoil Speakers by Rogue Amoeba, and Helium Music Manager by Intermedia Software. They sucked.
- Airfoil Speaker is a straight streaming application. You aim it toward your music collection and when you connect with the corresponding iPod app you get a stream of your music. The software appears FREE! on their website, but after you download it casually informs you that ten minutes to pay up $25 or it stops working. Nice. In any case it made pained choking noises and crashed out hard, although I would have uninstalled it anyways due to Rogue Amoeba’s deceptive advertising.
If you’re going to charge me for something, be up-front about it.
- Helium Music Manager and the Helium Remote for the iPod is more feature complete; the software suite has full library and playback functionality in addition to allowing you to stream music over your local network. Price-wise? They also do dodgy things by way of fiddling with European and Americans prices. Converted into USD, Intermedia’s full American price for their network-unlocked version is $58.31. Their European price is $66.84. In any event, Helium ate half of my music collection. I still don’t know where it went, but the folders vanished entirely. Thank goodness for daily remote backups.
Regardless of everything else, the two applications really felt like offerings for the lay user. I want something more powerful, more controllable and entirely less likely to nom on my music collection.
Three huzzahs for Linux!
Enter MPD, Music Player Daemon, and Icecast for Linux. MPD is something of a first cousin in functionality to MOC; they both operate as a background daemon and are connected to via a detachable client program. You could say one led me to the other. MPD differs from MOC in that clients are developed separately to the daemon; there are several excellent offerings for the different desktop environments and platforms…including MPoD, an iPhone/iPod client.
My MPD is broken!
In its default, configured state, MPD is intended to serve a local client. After you first install MPD (a simple
apt-get install mpd under Ubuntu), you need to configure it to play on your network. Copy the default configuration from
.mpdconf in your home folder. This is the basic (here is mine) configuration:
music_directory "~/Music" playlist_directory "~/Music/Playlists" db_file "~/.mpd/tag_cache" log_file "~/.mpd/log" pid_file "~/.mpd/pid" state_file "/var/lib/mpd/state" user "$YOURSELF" bind_to_address "127.0.0.1" port "6600"
Now pop open a terminal and type in
mpd --create-db. If nothing happens, congratulations! MPD is installed and working on your machine. If it bitches that something is already hogging 127.0.0.1,
su and enter:
[root][mark] $ netstat -lnptu Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:6600 0.0.0.0:* LISTEN 1742/mpd udp 0 0 0.0.0.0:68 0.0.0.0:* 1333/dhclient udp 0 0 0.0.0.0:37191 0.0.0.0:* 785/avahi-daemon: r udp 0 0 0.0.0.0:5353 0.0.0.0:* 785/avahi-daemon: r
Grad the PID of any program you see on 127.0.0.1 (in this case, the PID for MPD is
1742/mpd), and kill it with
kill. Bet you didn’t see that coming? Eh? CUPS is a persistent offender on my machine and usually I have to kill it before I can run MPD. At this point, try again. If it works, connect to MPD with a local client such as Sonata. If your Sonata makes the music go play, then you can pat yourself on the back for having a perfectly fully-functional installation of MPD on your box.
Icecast is a software daemon that takes your MPD collection and pushes it out over the Internet…and onto devices such as your iPod, which up to now has been the theoretical point of this freaking exercise.
So get your itchy keyboard fingers tap tap tapping and bash out
apt-get install icecast2 (assuming you are on an Ubuntu/Debian system. If not, replace “
apt-get” with “my package manager of choice” :). The default configuration file for Icecast can be found at
There is admittedly less configuration needed with Icecast; the project’s online documentation is excellent, and icecast.xml is well-commented and easy to grasp. As with MPD, you need to change certain items – the log files – for instance, to point at the home folder of the user you wish to run it on…
You should never run MPD or Icecast as root:
Icecast likes absolute paths instead of relative. Also change the needed password in the fields below:
<authentication> <!-- Sources log in with username 'source' --> <source-password>hackme</source-password> <!-- Relays log in username 'relay' --> <relay-password>hackme</relay-password> <!-- Admin logs in with the username given below --> <admin-user>admin</admin-user> <admin-password>hackme</admin-password> </authentication>
After this, run
icecast2 -b -c /path/to/icecast.xml. Did anything happen? No? You’re now running Icecast. Now the real work begins. Consult this documentation on combining MPD and Icecast. I stand on the shoulders of giants who have already written a HOWTO in exhausting detail.