HydraPlay – Open Source Multiroom Audio

Reading Time: 5 minutes

This article will describe why i created a new software called HydraPlay. HydraPlay is a user interface for a multiroom audio setup which consists of Raspberry Pis, Mopidy instances, Pulseaudio and Snapcast.

Why another UI for Mopidy?

A couple of weeks ago i found a youtube video of Ryan Danzel, who showed a very nice multiroorm audio solution based on snapcast. After long google investigations i finally found a piece of code at GitLab. I was not able to get it running, because i didn’t understand how the software communicates with snapcast, while the mopidy communication was done by MQTT. First i liked the idea of using MQTT, because this would make the communication more transparent related to port configurations of multiple Mopidy instance on a Raspberry Pi. At the end i came up with using JSONRPC as communication protocol. Snapcast and Mopidy are able to communicate over JSONRPC (2,3) while Mopidy delivers a JavaScript library with web socket support for it, Snapcast only speaks with native TCP sockets. Ouch…! So i needed another piece of software, it routes web socket connections to the TCP/IP interface of sncapcast. For this job the setup uses Websockify as Websocket-Proxy between Snapserver and HydraPlay.

How things are hooked up

Ryans UI code was based on JavaScript by using the react framework. During studying the code i learned a lot about MQTT and react.js. But at the end i decided to switch over to Angular 7. I also need to migrate the FabScan UI to Angular 7 one day, so this was a nice exercise for me to learn Angular 7. I ended up by using only the CSS and HTML parts of the original code. A big thanks you to Ryan Danzel for his great work!

Lets start with the Hardware Setup.

I used 3 Raspberry Pi’s for my initial setup. One of the Pi’s as server the others as audio clients. I have ceiling speakers installed at the ground floor of my house, so the wiring is centralised at the basement. That is the point where i installed the Raspberry Pi’s in a self printed mini rack found on Thingiverse.

For amplification of the audio signal i used Pimoronis phat beat.You can also use normal active speakers connected to the Raspberry Pis audio jack. I am using this HAT because, as i mentioned before, i am using passive wall/ceiling speakers. My solution is quite good for ambient music and listening to radio stations on Tune-In. For the Party mode i am planing to have a wireless Raspberry Pi Zero connected to my Teufel 5.1 surround system.

Finally everything is hooked up on some self build rails rails.

I know wiring looks a litte bit messy but it works…

Server Side Software Setup

I started with a clean Raspbian installation on a Raspberry Pi 3B+. I strictly recommend to use a Raspberry Pi 3B+ or the new Raspberry Pi 4 Model B here, because there will run a lot of services in parallel on the system. Every steam is represented by a Mopidy instance.

The Software Setup consists of Pulseaudio which will provide the audio sinks for the Snapcast Server. Snapcast Server is the Heartbeat of the project. It provides all the multiroom audio magic behind the scenes. I use multiple mopidy instances as audio stream provider. Each stream provider can provide audio from multiple audio sources, like spotify, tunein or local stored mp3s. There are a lot of plugins available to extend mopidy in a way that it can provide other possible sources.

You can find detailed installation Instructions on GitHub. Hopefully I will be able to create a bash script or even better a running docker configuration to make the basic setup easier for Linux newbies.

Client Side Software Setup

The software setup on the client side is straight forward. Just install a plain minimal Raspbian on the Raspberry Pi. If you are using the Pimoroni pHAT beat, like on the picture above, you need to install the pHat beat drivers. Simply follow the instructions on the „Getting Started“ Guide on the Pimoroni Blog.

Finally you need to install the Snapclient on the Client side Raspberry pi. Thats all. If all components are hooked up the setup should be able to run.

Testing the Setup

How to select a new stream/source for a player/zone.

Now you are able to connect to the player by pointing your Browser to the local IP address of your Snapcast Server and the port of the running HydraPlay daemon. (e.g. https://192.168.1.10:8080).

You should the the User Interface of HydraPlay, which shows as many audio players as clients are configured. If you click on the cover icon of a player, the media library will open. You are able to select a stream (source) to play on the selected player. Use the search to browse the library.

HydraPlay Media Library with TuneIn search results.

HydraPlay only support Tune-In by now. But it should be simple to integrate the Mopidy Spotify Plugin. I am using HydraPlay for a couple of month now and I can say that the basic setup is doing a good job.

I will do further development when I have the time or I need new features on HydraPlay. But if you are a programmer and you want to contribute to the project feel free to contact me on GitHub or leave just a comment here.

UPDATE: Spotify works out of the box, only the cover art work is not working, because the data structure in Mopidy differs from the one of TuneIn. There is already a branch where i am working on a Spotify integration on GitHub.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Kommentare werden moderiert. Es kann etwas dauern, bis dein Kommentar angezeigt wird.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.