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