Multi room audio with raspberry pi

So I’ve had a though for a while that I’d like something like Sonos in my home, but something like that is wayyyy out of my price range. Then I got thinking, surely opensource can do this!

I’ve just spent most of the day researching and setting up a solution. The first thing that came up was pulseaudio. This cool piece of software can do all sorts, and one of them being able to setup up a client-server like environment to stream audio from a pulseaudio “server” over multicast to any mpd “client” who is listening. The theory behind this is you can set up multiple broadcast’s and have each device listening on different ones, plus all listening to on the same one. So you could stream to all devices, or to individual ones. The problem with this way (from what I could find) was that there was no easy, user friendly way to switch “zones” (broadcast addresses) on the server to play to different devices. This wouldn’t fly with the wife! Although this would be a nice, quick solution for most tech people

I needed something that could be “user” friendly (super simple), that was easy to use, that would have an android and/or iOS app to control the server and that didn’t require much else then pushing a few buttons in an app to make it work. I eventually found mopidy (https://www.mopidy.com/) I choose this as it ties into a few music streaming services, as I don’t have a large collection of local music, I listen mainly to spotify. It also has some nice apps available on Android, iOS and a web client, so controlling the server would be nice and simple. Hooking into this to allow for multi-room streaming I used snapcast (https://github.com/badaix/snapcast) a nice c# program to allow for client-server streaming with as many clients as you like. Unfortunately it doesn’t support “Zones” yet (which I originally wanted), but its on the todo list As I have 3 rpi’s in my house, I will be using them as my audio clients, and server. I will be hooking one pi into my lounge surround sound, and have an old speaker system that I use in the Kitchen

Hardware: 1x rpi 2 (as the server) 2 x rpi B (as the clients) Speakers to plug into the “clients”

For now I have just plugged everything into the 3.5” jack on the rpi, but I have read alot that the quality of this sound is terrible (I didn’t notice too much in my tests) and that getting a USB audio device would be a much better idea. So maybe when I start noticing quality, that will be the first thing to check

Software: mopidy snapcast

Installing mopidy was a breeze, just followed their instructions on their wiki (https://docs.mopidy.com/en/latest/installation/raspberrypi/)

Install the spotify plugin

sudo apt-get install mopidy-spotify

Once I got to snapcast, it needed a few dependencies, which rasbian (wheezy) didn’t care for. It was running older versions of the software needed and it didnt look like I could update it easily, so I bit the bullet and upgraded to Jessie

This took ages! most of my time was spent waiting around for it to download and build, it probably would have been quicker to download the Jessie iso, re-flash the SD card and re-install everything. But once it was done, installing it was easy, and setup was even easier

Just start mopidy on the server

mopidy

and start the server portion of snapcast

sudo snapserver -d

and start the client portion of snapcast on your streaming client

sudo snapclient -d
#(or `sudo service snapclient start` . I had issues with running via \
     #init.d and found it easier to start the service with the snapclient command)#

Then control your mopidy server with your favourite method (mine was android app) and magic!

I haven’t included the commands yet, so maybe i’ll add them if i can run history on my pi Hope this helps someone, as finding an opensource/cheap solution for this was harder then I thought!

Here are some other alternatives you can use too, especially if most of your collection of music is locally stored:

  1. Squeezebox (http://monksoundworks.blogspot.com.au/2014/03/raspberry-pi-multi-room-audio-solved.html)
  2. Volumio - http://volumio.org/
  3. Pi music Box - (pretty much a nice GUI ontop of mopidy) http://www.pimusicbox.com/

As I was writing this, I found this - https://github.com/thaytan/aurena. Seems very cool as it already supports “Zones” I will see if it ties into modipy or streaming services!