Raspberry Pi Volumio Multi-room Audio Sync Using SnapCast How-To

Background: I didn’t want to go the expensive Sonos way, but instead wanted to try making multi-room audio sync working using multiple Rasberry Pis with the Volumio OS. For the units where I wanted really good sound quality I added two HifiBerry DAC + Pro to the Raspberry Pis.

I’m writing this blog because it took me a LOT of time and effort making this work because I couldn’t find a clear step-by-step instruction what to do and what settings to use. I got stuck and couldn’t make it work trying to just follow the Quick Start guidelines at https://github.com/Saiyato/volumio-snapcast-plugin. However, in the end when I knew exactly what to do, I could add an additional slave Pi as music source in about 15 minutes. Hopefully this blog will help others get this right while waiting for Volumio to include multi-room audio sync in the actual Volumio distro.

HW/SW setup: 4 Raspberry Pi 3 flashed with the Volumio OS distro ver. 2.587. For two of the Pis, where I have a requirement for really good audio quality, I have also mounted HifiBerry DAC + Pros to the Pis. The other two Pis just use the RCA audio out from the Pi boards because I have those in low-prio rooms with just a simple active speaker. (The RCA audio output gives quite poor sound quality.)

IMPORTANT: Do NOT change the default volumio password until your are all done. Otherwise all plugin installations will fail.

For each of your multi-room devices (the Raspberry Pis) do this:

  • Install the latest volumio OS to the micro SD card. (I’m using Balena Etcher for Windows for that.)
  • Plug in an ethernet cable for the local network
  • Power up the device
  • Identify the IP of the device (From Windows run ”net view” to see the Volumio device appear and ”arp -a” for the IP number.)
  • Use a browser and enter the local IP
  • Finish the setup Wizard. Name the devices ”volumio-n” where n is a number 1, 2, 3 and so on. Choose English as language just to be safe. (I had trouble with Saiyato’s SnapCast plugin when using Swedish but not sure if it was the language that was the problem.)
  • At this point, when the Pis are connected to the Wifi network, I recommend connecting two of the Pis to simple, active speakers (one will later become master and the other slave) to verify that they can play some music stored just on the internal storage of the devices. This rules out problems with the sound itself or the speakers not working. Just make sure you hear music from both devices before proceeding.
  • SSH to the shell of the device.
  • Download the latest plugin zip for Saiyato’s SnapCast plugin ($ wget https://github.com/Saiyato/volumio-snapcast-plugin/archive/master.zip)
  • Run the following commands in the shell:
    • sudo apt-get update
    • sudo apt-get install unzip
    • unzip master.zip
    • cd volumio-snapcast-plugin-master
    • rm volumio-snapcast-plugin.zip
    • volumio plugin install

At this point the music should stop playing on the device, if you followed the advice above and had some music playing.

Step one – making it work with just the audio jack output (Not using a HifiBerry DAC yet)

  • Browse to the server device’s UI. (Use the actual IP not the volumio-n.local which doesn’t work, at least not for me.)
  • Go to the menu and choose Plugins. Click the tab ”Installed Plugins”, and turn SnapCast On.
  • ONLY for the master device: In the SnapCast plugin settings make sure that the option ”Enable SnapServer” is turned On. Use the following server settings:
    • Name of the main stream: VOLUMIO-MPD
    • Sample Rate: 48000HZ
    • Bit Depth: 16 bits
    • Sound Channels: 2
    • Codec to use: Flac
    • Additional CLI Commands: [empty]
    • Click Save. If you get an error about failure for the touch command ignore this. Click Save again and the error should not be there anymore.
    • Under SnapClient Settings, use the following (still only for the master):
    • Enalbe SnapClient: On
    • Voumio Host: Localhost
    • Define A Custom Host: Off
    • Soundcard to use for playback: Audio Jack
    • Additional CLI Commands: [empty]
    • Click Save. If you get an error about failure for the touch command ignore this. Click Save again and the error should not be there anymore.
  • At this point the music from the master device should be heard again in the speakers. (The master device’s client software is playing the music outputed by the server software to localhost.) If not, continue the steps below and it will probably work after rebooting the device.
  • Under MPD Settings, use the following settings:
    • Pach Mpd.conf: On
    • MPD Sample Rate: 48000Hz
    • MPD Bit Depth: 16 bits
    • MPD Channels: 2
    • ALSA Output For MPD: Off
    • FIFO Output for MPD: On
    • Click (Re)patch mpd.conf
    • Under the Patch ALSA Configuration section, click ”Patch file”.
  • Reboot the master device. Try playing some song stored internally and make sure you get sound.
  • Repeat the SnapCast + MPD Settings + Patch ALSA Configuration procedure above for all slave devices except turn ”Enable SnapServer” to Off, and for ”Volumio Host” under the client settings choose ”Volumio-1” from the drop-down list (instead of localhost), and under MPD Settings set FIFO Output for MPD to Off. Click ”Save”, ”(Re)patch mpd.conf” and ”Patch file” under the ALSA Configuration. You should now hear the same music in all the clients as you hear from the server. Try rebooting all the devices once if it doesn’t work, starting with the master.
    • Note: The ”Repatch of mpd.conf” command seems a little… temperamental, which may be why I sometimes had to reboot the devices to make it work after clicking on the (Re)patch mpd.conf button.
  • Note: If the audio sync stops working in the slaves after you have rebooted devices, go to the plugin section and verify under SnapClient Settings that the Volumio host is Volumio-1. It seems that if the clients reboot when the master is unavailable it resets itself to localhost and no music is heard.

Additional fixes:

  • Note: in my network, I had to increase the buffer size on the devices a little to avoid glitches in the music. To do this, go to Playback Options… General Playback Options… Audio Buffer Size, and set it to 12 MB on all devices. (You can start with the default 8 MB and increase it until glitches no longer appear in your setup.)
  • Note: If you want the master device to play music stored on a NAS, I had to do the following little dark magic to make my Netgear NAS work with Volumio: Go to Settings… My Music… Network drives… In the Options field, enter: ”vers=1.0”. Don’t ask me why, but it made it work.
  • Note: If you change the Master to use Playback Option HDMI out and things stop working, you may have to (Re)patch mpd.conf and restart the master to make it work again.
  • At this point I also installed the YouTube and Spotify plugins.
  • Change the default password on all devices. Reboot the devices and verify that it still works.

Adding the HifiBerry DAC + Pros:

  • At this point, when the audio sync was working using the audio jack, I installed two HifiBerry DAC + Pro to the master device and one of the slaves. This gives a lot better sound quality compared to the Audio Jack. It also has the benefit compared to using HDMI output that the receiver doesn’t have to output the Volumio shell prompt to the TV. (My HDMI sound disappeared if I turned of the TV or switched away from the Volumio HDMI output.)
  • I mounted the HifiBerries on the Pis according to other instructions which went very smoothly. At first, it seemed that Volumio or SnapCast didn’t recognize the devices. Couldn’t make it work. Rebooted at least once and then the ”HifiBerry DAC Plus” appeared as Output Device both under General Playback Options (I2S DAC set to On), and under Soundcard To Use For Playback under the SnapClient plugin settings. Clicking Save and rebooting made it work getting the sound from the HifiBerries instead of the Audio Jack.
  • Note: Under Current Volumio Sound Config, Output Device is set to Audio Jack for some reason, even on the devices that has a HifiBerry, but this doesn’t seem to matter for the HifiBerry to work.

Final note: I have so far been unsuccessful in making the multi-room audio sync work when I play Spotify on the master device. It works playing Spotify on the individual slaves but not synched from the master. If anyone gets that working, please comment this blog and let me know how to do it.

Enjoy the music!
Special thanks to Saiyato for writing the SnapCast plugin for Volumio.

Kommentera

E-postadressen publiceras inte. Obligatoriska fält är märkta *