For some time I’ve been wanting to get audio playing around the house without needing to turn things on and off, and now I’ve got multi-room synchronised audio playing in four rooms!
The basis of this is a pair Of Raspberry Pi’s – a 3b and a Zero-W. The former I already had for this purpose with a HifiBerry DAC+ and the latter I bought with its own HifiBerry “Dac Zero” with case to see how it would handle streaming audio over wi-fi (it does).

Volumio was a relatively recent discovery and seems to work pretty well, after a few teething issues with the remote library (my big NFS server) disappearing on reboot and the various tweaks needed for getting snapcast (the underlying audio streaming system) working.
It does seem to work better with a micro-sd card bigger than 8G, so I am using a 128G card in each device. (otherwise it complained about not enough space).
The version of Volumio I’m using is 2.882 which is available here. It’s based on raspbian, so can be managed like a standard Pi, but with some external repo’s that you generally won’t have to worry about it.

The disappearing media library
Apparently, this may have been caused by a mismatch between the supplied/default version of mpd (Media Player Daemon) and the one that gets installed if you “apt update”.
Resolved by
$ sudo ln -s /opt/vc/lib/libbcm_host.so /usr/lib/
$ sudo reboot

Reference:
https://community.volumio.org/t/mpd-broken-in-volumio-2-5-26/9774


Snapcast not starting/playing to another device
Basically, the recommendation is to run snapcast with a sample rate of 48KHz, which then requires some changes to the mpd & snapcast config files. But also, the default packages seem to not create the appropriate directories for their pid files, which stops the daemons from starting and may or may not be an upstream issue with the packages. The same changes apply to the primary and secondary devices, just depending on whether you have snapserver running or not. Basically, what you end up with is all the services sending their audio to the socket, which is picked up by snapclient, whether on the same device or over the network.

sudo mkdir /run/snapserver /run/snapclient
sudo chmod 755 /run/snapserver /run/snapclient

then in /etc/default/snapserver, have:

USER_OPTS=”–user snapserver:snapserver”
SNAPSERVER_OPTS=”-d -s pipe:///tmp/snapfifo?name=VOLUMIO-MPD&mode=read&sampleformat=48000:16:2 -s pipe:///tmp/spotififo?name=VOLUMIO-SPOTIFY&mode=read&sampleformat=48000:16:2 ”

in /etc/default/snapclient

USER_OPTS=”–user snapclient:audio”
SNAPCLIENT_OPTS=”-d -s 30 ${USER_OPTS} –logsink=system”

and to get mpd to play to the pipe of /tmp/snapfifo, ensure you have in /etc/mpd.conf

audio_output {
type “fifo”
enabled “yes”
name “multiroom”
path “/tmp/snapfifo”
format “48000:16:2”
}


Running Spotify on the primary (and compensating for different sample rates)

The Spotify client actually works quite well, but will only appear in the main menu once you’ve logged in.
The issue I had was that it was playing at the wrong sample rate, with the music playing faster (the difference between 44.1 & 48KHz)
So in the lower half of the file /etc/spopd.conf you need the following:
[sox]
output_type = raw
output_name = /tmp/snapfifo
effects = rate -v 48000

Reference:
https://community.volumio.org/t/guide-multiroom-audio-output-from-volumio-with-snapcast/2980/32


Running Spotify connect
If you also want to run the Spotify Connect plugin, this also needs some changes to stream the same way as everything else

sudo sed -i — ‘s|device =.*|device = \x27/tmp/snapfifo\x27|g’ /data/plugins/music_service/volspotconnect2/volspotify.tmpl

sudo sed -i — ‘s|backend =.*|backend = \x27pipe\x27|g’ /data/plugins/music_service/volspotconnect2/volspotify.tmpl

but these files then had ^M at the end of lines, so I installed the dos2unix utility and fixed them with that.
Reference:
https://community.volumio.org/t/snapcast-spotify-issue/42356


Getting the HifiBerry DAC Zero to work with the Pi Zero-W.
Basically, the official instructions have the wrong model described, so I had to add into /boot/config

# dtparam=audio=on # disables hdmi sound etc
dtoverlay=hifiberry-dac # changed from default
and then it worked great!

So after this extra bit of pain, it all works actually rather well.
I was wondering whether I needed “More Pi’s” for the rest of the house, then I discovered there’s a snapcast app for Android, which I have installed on my NVidia Shield TV devices (sideloaded via the Google Files app), which even seems to run in the background, so not requiring you to switch out of Kodi or whatever.
Currently, I am using the snapcast app for adjusting/muting the volume levels in each room as opposed to the Volumio app, as it just seems easier and because of the mix of devices.
But generally, being able to play my music collection to whatever room, while wandering around the house is great.
At some point I hope to also have multi-source running as well, so different ‘zones’ can have different music.
I hope these notes are useful to some of you.

Links

Get Started – Volumio


https://www.hifiberry.com/shop/boards/hifiberry-dac-zero/
https://www.hifiberry.com/shop/cases/hifiberry-case-for-dac-zero/