Manual enable Multiroom in Volumio 3 / Music via Snapclient/Server

I’m searching for some Information how to manually (commandline) switch volumio 3 into the multiroom state. Basically I would like to perform manually the steps which are done on the server side when another volumio instance is added for multiroom playback.

I have the superstar subscription but I would like to use some old low power raspberry devices (raspberry one, two and rapsbery zero) for simple remote playback clients. Installing Volumio on them is not an option because this is awfully slow and I also like to run them from a read only filesystem in order to just unplug them when not needed anymore.

Connection two Volumio 3 instances and running multiroom I figured out that at least the following steps have to be performed:

Create the file /tmp/multiroom/client/snapclient.conf with content similar to this:

START_SNAPCLIENT=true
USER_OPTS="–user _snapclient:audio"
SNAPCLIENT_OPTS="-s volumioMultiRoomClient -h 127.0.0.1"

Create the file /tmp/multiroom/server/snapserver.conf with content similar to this:

START_SNAPSERVER=true
USER_OPTS="–user _snapserver:_snapserver"
SNAPSERVER_OPTS="-s pipe:///tmp/multiroom/server/fifo?name=Radio&sampleformat=48000:16:2&codec=flac --streamBuffer 50 -b 1500"

  • sudo systemctl restart volumioSnapclient
  • sudo systemctl restart volumioSnapserver
  • mpc enable only multiroom

After these steps the volumio server still doesn’t seem to play the music via the Snapserver and Snapclient but through the standard audio pipe …

Anybody knows what step is missing? After that I will be happy to post a description how to setup a readonly snapclient instance on a read only PI.

If I connect two volumio instances via multiroom connecting a third “thin client” already works…

Ok - not everything up there was correct. I resolved this now. If anybody is interested in a low resource playing client please PM me.

I am interested in this @bibomator :slight_smile: I have six Volumio 3 devices in six different rooms. Using the API or the command line, I sometimes want to group all devices into one snapcast group and sometimes only 2-3 rooms.
Maybe your solution would give me a hint how to implement this?

I am also interested in this. A low resource client is that what would fits the best for me.
@bibomator: Are the clients also shown in the devices/zones list in the ui?

General I can say that the setup works fine for me. I have to enable the streaming in the Volumio Raspberry and then simply start the clients (which are first generation raspberries connected via Ethernet cable). These clients have a read only filesystem - hence I simply turn them on and off. These clients are not displayed in the userinterface, they simply play the content of the main Volumio which I control via the mobile app.

How did I do it (warning: I guess you need some linux know how to follow this):

Installation of the client:

  • Install a Raspberrian lite on the flashcard, boot update etc.
  • edit /boot/config.txt for enabling audio
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
audio_pwm_mode=2 
hdmi_ignore_edid_audio=1
  • test the speaker with speaker-test -t wav
  • Install the packages needed for the snapclient: apt-get -y install joe libasyncns0 libavahi-client3 libflac8 libice6 libogg0 libopus0 libpulse0 libsm6 libsndfile1 libsoxr0 libvorbis0a libvorbisenc2 libx11-xcb1 libxi6 libxtst6 x11-common
  • Download the fitting snapclient from here (Version armhf): https://github.com/badaix/snapcast/releases
  • Install Snaclient dpkg -i Snapcast….
  • I wound like to use internal Hostnames - hence modify the resolve order in /etc/nsswitch.conf to:
hosts:          dns files [NOTFOUND=return]
  • add the config for the snapclient /etc/default/snapclient
# Start the client, used only by the init.d script
START_SNAPCLIENT=true

# Additional command line options that will be passed to snapclient
# note that user/group should be configured in the init.d script or the systemd unit file
# For a list of available options, invoke "snapclient --help" 
SNAPCLIENT_OPTS="--latency=1  -h <volumio_server> -s7"
  • Service Enable: systemctl enable snapclient
  • Disable unneeded service: systemctl disable wpa_supplicant.service
  • check if everything works - inc. audio. if it does make the system read only: sudo raspi-config → Performance options → Overlay File System

Now how I run stuff on the server: I created a script which replicates the config files which are originally created by volumio if you use multi room. I will not post this script here because I think it wont be right, to enable people to circumvent payment (not sure if this would be possible - I’m a paying customer) . Hence I only describe what steps need to be performed.
@Volumio Team: If you read this: Could you PLEASE provide a possibility to start the USB sound device via the Web API?

On the Volumio server I perform the following steps for starting:

  • Stop the music via an API Call if its playing: curl -m 2 -s -o /dev/null localhost:3000/api/v1/commands/?cmd=pause
  • Write the content of the config file /tmp/multiroom/client/snapclient.conf (You can figure out the content by test running multi room with two devices)
  • Write the content of the config file /tmp/multiroom/server/snapserver.conf
  • sync the filesystem
  • Start the Snapclient: systemctl restart volumioSnapclient
  • Switch the Server targets:
    • echo “volumioMultiRoom” >/tmp/multiroom/server/switch.target
    • echo “S” >/tmp/multiroom/client/switch.fifo &
  • Switch the client Targets:
    • echo “volumioLocalPlayback” >/tmp/multiroom/client/switch.target
    • echo “S” >/tmp/multiroom/client/switch.fifo &
  • Start the Snapserver: systemctl restart volumioSnapserver
  • Resume music if it was playing: curl -m 2 -s -o /dev/null localhost:3000/api/v1/commands/?cmd=play

For Stopping the Multiroom:

  • Stop the Music if playing: curl -m 2 -s -o /dev/null localhost:3000/api/v1/commands/?cmd=paus
  • Switch back the Server Targets:
    • echo “volumioLocalPlayback” >/tmp/multiroom/server/switch.target
    • echo “S” >/tmp/multiroom/server/switch.fifo &
  • Switch back the client target
    • echo “volumioDiscard” >/tmp/multiroom/client/switch.target
    • echo “S” >/tmp/multiroom/client/switch.fifo &
  • Start msuic if it was playing: curl -m 2 -s -o /dev/null localhost:3000/api/v1/commands/?cmd=play
  • Stop the Snapclient: systemctl stop volumioSnapclient
  • Stop the Snapserver: systemctl stop volumioSnapclient

thank you very much! That’s an interesting setup. I think it’s very fair that you don’t want to undermine Volumio’s premium model. I am also a premium user.

I still want to use the flexibility of Volumio in every room. I just want to automatically assign devices to different groups sometimes. And I sometimes want to integrate a Snapcast server that is not based on Volumio (I wrote a feature request for this).

Your explanations now give me an insight into how you control Volumio from the command line. This gives me a better starting point to implement my ideas.

one more comment. In order to get the correct “-s” argument when starting the snapclient the command line argument
-l, --list list pcm devices

is extremely helpful.

I would also like to share a small python app running on my volumio raspberry providing a basic webinterface running on port 3002 to start and stop the multi room feature easily.

It look like that:
grafik

Installation:

  • Extract the ZIp into the directory /home/volumio/music_mutiroom
  • copy the script in the service directory to /etc/systemd/system/
  • enable it via systemctl enable multiroomctrl.service
  • The magic is done in /music_multiroom/webserver/cgi-bin/multiroom.py - this the runs the bash script in /usr/local/bin/snap.sh which then does the stuff mentioned in my previous posts.

music_multiroom.zip (8.6 MB)

1 Like

@bibomator thanks for your work with figuring things out :slight_smile:

I’m a paid user, for quite a long time I’ve been using version 2 with self compiled and configured snapcast and just recently switched to version 3.
My setup may not be that simplistic as with version 3 I’ve switched to a virtual machine (running on a proxmox stuffed OptiPlex 7040) as main player.
First shot with multiroom provided by @volumio was horrific - it looks as if noone there really tested the solution… Master player playing directly to the sound device and clients synced to a snapcast pipe. Yeah, headbang all the time :joy:

For a time being I’ve just added an obsolete physical machine but will be switching to a proper snapcast setup very soon :metal: Since most of the reverse engineering of IMHO poor design was done it’ll be way faster :slight_smile:

That’s not how the system works (would be very naive if we did that…)

Few questions:

  • Why did you think we designed it that way?
  • What were exactly the issues you were experiencing?
  • What’s your use case for using a VM as main Volumio player?

SIDE NOTE: Using a VM as Multiroom master is not a wise idea, you will never get properly synced audio since VM audio stack is likely to introduce delay which we can’t account for to sync audio. Not to mention that I doubt the VM virtual audio card will play well with the FIFO and switcher mechanism which is the base of how we implemented multiroom

@volumio first of all I have to apologise - I’ve checked and actually it’s not the way it works - sorry :pleading_face:

I’ve got that false impresion because I experienced a consistent delay between a master serving a stream to clients - all the clients were in sync except the master.

One more important thing - grouping config gets losf after a reboot - that’s something should be added to the system since normal snapserver configuration preserves that information.

I know that using a VM is a bit akward but it’s a convenience and network architecture thing. I happen to have a dedicated machine for VMs running some essential stuff like pihole, home automation software, etc. Adding a central server is just a logical extension of that setup, moreover it would allow me to eliminate one unnecesary physical machine :slightly_smiling_face:
Those are the only real reasons :slight_smile:

Best regards