๐ŸŽผ Shairport and the Joys of Multi-Room Audio ๐ŸŽต

Posted on .

I love listening to music. I carry my music collection wherever I go (in the form of an MP3 player), be it work, school or vacation. My last.fm profile logs tens of tracks every day and can probably creepily accurately pinpoint when I'm at work, alone at home or travelling from place to place. With this said, listening to music at home has earlier been somewhat of a chore โ€“ or at least I feel like it now.

Since I'm pretty often on the move with my laptop, I grew tired of having to pull the audio cord from the living room stereo receiver every time I wanted to listen to something. And when I did listen to something, I often alternated between the living room and the kitchen, where nothing was playing. Sometimes I resorted to putting the receiver in the living room at full blast to kind of hear it everywhere in the apartment โ€“ sorry neighbors.

But better times were coming. I had one Raspberry Pi Model B lying around doing nothing and got a second one from a friend as part of an electronics purchase. I decided to find out if I could use these as AirPlay receivers to enable wireless playing from my laptop or MP3 player. After some iterations, I found the answer: Shairport Sync.

Shairport Sync is a fork and rewrite of an older Shairport (which I used on a single rPi at some point with adequate results). It has better compatibility with different audio outputs, feels more stable and most importantly has seamless multi-room audio support. That's right, you can play to multiple Shairport receivers and they keep the audio stream in sync automatically. I can stand midway between the living room and kitchen and be unable to hear any difference in the timing of the outputs.

Installation was pretty easy. I used a basic Raspbian install, got the required packages (the Shairport Sync instructions have a helpful list) and then it was just a matter of following the instructions to build and install the software (basically git clone โ†’ autoreconf โ†’ ./configure โ†’ make โ†’ sudo make install). I used the following example from Shairport's page to configure the init.d script:

shairport-sync -d -a "Mike's Boombox" -- -d hw:0 -t hardware -c PCM

The part after the name sets up the correct output for the rPi. It drives the output really well, with no noise or distortion that I can hear.

You can control all outputs separately.

The end result is pretty cool. When playing music, I can just choose the output I want and it will connect to that receiver. I can play in the living room, in the kitchen or both. I could play one song in the living room and another in the kitchen. I can move my laptop or MP3 player anywhere in the apartment without having to fiddle with cables. Just a constant stream of music anywhere I want. ๐Ÿ”Š๐ŸŽถ

The kitchen receiver which is still missing a case. It uses a Buffalo 802.11n dongle to connect to the network.
The living room receiver on top of my Dantax P-1000 speaker โ€“ this one is connected to the wired network.
In the kitchen, bass is handled by my old and trusty Cambridge Soundworks subwoofer.

In the future, I plan on getting one additional rPi to enable music in the bedroom as well. Then I will have wireless, synced music playback for the whole apartment, and at a fraction of the cost of buying three Airport Expresses or other official receivers.