Music Sharing Pain on a Raspberry Pi

Like every cool kid on the ’net, I now own a Raspberry Pi. At first, I wasn’t really sure what to do with the RPi but it finally dawned on me, to use it as a music streaming server. With a mere 3.5 W for the whole board, it is reasonable to keep it powered on, even when considering my wallet. Moreover, I planned to attach it to my little Kenwood K-521 stereo system and use the RPi as another source of music with MPD.

For starters, I installed the officially supported Raspbian distribution on a SD card that I had lying around. Unfortunately, I wrote the image with

dd bs=1M if=2012-07-15-wheezy-raspbian.img of=/dev/sdc1

which was not working. Of course, dd needs to write to the device /dev/sdc not to the partition /dev/sdc1. After fixing this minor problem, things were alright: the LEDs are blinking and I could connect via SSH. Until I started setting up music streaming …

There is an endless list of streaming server solutions. However, in my case I want to select a particular title on the RPi that in turn streams the music to my local machine. For this purpose, there are two general solutions: DAAP developed by Apple for its iTunes platform (well, okay …) and UPnP/DLNA developed by a consortium and often used in settop appliances. Of course I need server software on the RPi and a suitable client on my local machine and this is where the dilemma begins.

I am not overly fond of a proprietary protocol developed by Apple, so I tried DLNA first. In the Debian packages there are packages for minidlna and Rygel, two servers that fit the bill. Back on my Ubuntu 12.04 desktop things aren’t that nice anymore. I wanted to use Rhythmbox or Banshee but both lost native UPnP client capabilities some time ago. UPnP support comes back with the Grilo framework, but this is currently not enabled on Ubuntu builds. I tried to built Rhythmbox from source but that failed somewhere in the build process. VLC is capable of UPnP but sucks as a music player the same way that XBMC is way too big for my purposes.

So, back to the drawing board. After browsing Rhythmbox’ and Banshee’s feature list, I knew both players receive content streamed with DAAP. Unfortunately, there are virtually no working DAAP servers on Debian ARM based Raspbian distribution. In the old days, one would install the mt-daapd server that has a questionable code quality. For better or worse, there are no mt-daapd packages for Raspbian. Then I read about the dmapd DAAP server which has to be built from source. But again, no luck. Then I learnt, that a developer took the old mt-daapd code, rewrote it in a sane way and called it forked-daapd, which is the de facto DAAP server nowadays. Well, on i386 and x86_64 at least. For some reason, he started developing a gcd branch that requires the Clang compiler which does not yet support ARM architectures. Because the Debian maintainers do not want to ship a forked-daapd that does not receive security updates in the future, they removed the non-Clang version from the repository. In despair, I took the latest forked-daapd release that compiles with gcc and tried to build it. Turns out, that in his old code base he relies on libevent 1.4 whereas the Debian maintainers decided to ship libevent 2.0 …

What to do? The simple answer: pulling in Mono and installing the Tangerine DAAP “server”. It works pretty well, but because it is not designed to be a real server software, there are no init scripts and it does not integrate with common system software. To get a running server after boot, I pulled out the hammer and added this to /etc/rc.local:

/usr/bin/tangerine & disown

This is horrible in so many ways, but after wasting so much time, I was finally looking for a fast rather than nice way. Although Tangerine is written in C#, it is remarkably light weight:

This is just what I wanted:

This solution is anything but perfect and still misses some important components: I will have to buy a small WiFi USB adapter, a real power supply (I am currently using the charger for my Nexus S) and an external HDD case where I will put on the music. Then I have to hook it up to the Kenwood system and configure MPD. Hopefully, the digital-to-analog converter is not as bad as people are complaining on the Raspberry Pi forums. Finally, I have to think about a real case for the Raspberry Pi. I hope these steps will not be as annoying as installing a media streaming server.