DIY Raspberry Pi multi room audio system with Volumio

Volumio is a great dedicated audio player for raspberry pi, with integrated support for Spotify Connect.

I built my own Volumio player with a Raspberry Pi Zero W, + Hifi-Berry DAC+ Zero Raw

Here’s a short step by step how to install the snapcast plugin by saiyato, to use volumio as a multi room audio system:

    1. Install Volumio
    2. activate SSH on your Volumio (via the webinterface: “http://volumio.local/dev”)
    3. install the snapcast plugin via SSH (SSH username=volumio, pass=volumio)
      1. git clone https://github.com/Saiyato/volumio-snapcast-plugin.git
      2. cd volumio-snapcast-plugin/
      3. rm volumio-snapcast-plugin.zip
      4. volumio plugin install
    4. configure the snapcast plugin via the webinterface on your server and your clients. Should be self-explanatory
    5. Nice-to-have: the android app “SnapDroid”, which lets you set the individual volumes of the snapcast devices

The advantage of the Snapcast solution over other multi-room systems is that Snapcast picks up the audio signal after the source and distributes it to the clients as an audio stream (FLAC, PCM or .ogg – FLAC works best). That’s the only way to serve multiple clients simultaneously with just one Spotify account.

Codec wise, you can choose from PCM, ogg and FLAC. FLAC together with “-c flac: 4” in the “Additional CLI commands” sounds and works best, here’s more info.

If you want to use Spotify Connect, it gets a bit more complicated:

  1. Install “Volumio Spotify Connect 2” via the plugin menu in the web interface and activate if not already done
  2. Under the snapcast plug-in settings both at the server, as well as with all clients, set everywhere 44.1 kHz, otherwise it comes to funny errors in resampling (otherwise Spotify music is too fast / hochgepitched)
  3. Under the snap-shot plug-in settings of the server, in the “Spotify Integration” section, set “volspotconnect2” and click save
  4. Reload the Snapcast plug-in window
  5. The selection field under “Patch Spotify Configuration File” should now have been updated automatically according to the upper settings. In our case there should be “volspotifyconnect2”.
  6. Now click on “patch file”
  7. Switch to the Spotify Connect plugin
  8. Click here directly on “save” (the previously patched file is now activated)
  9. Finished

If you want to use the Spotify stand-alone plug-in from Volumio, follow the steps above. However, at the time of this blog entry, the standalone Spotify plugin is broken because Spotify has recently changed the API – you can no longer browse its playlists. There is a somewhat complicated temporary fix here (you need a refresh token for this). Update December 2019: A fixed official Plugin got released recently!

Àpropos “Fix”: For some reason, Volumio doesn’t fetch the correct time zone, UTC is assumed. To fix that, you enter the following via SSH:

sudo nano /etc/default/crda
in the editor then complete:
REGDOMAIN=ETSI
save and close, then:
timedatectl set-ntp tru
sudo dpkg-reconfigure tzdata
then follow the menu and set the correct time zone, in my case Europe> Berlin. Check if it worked, go with:
date

Bonus!
If you have an old laptop lying around, you can also install the x86 version of Volumio on a bootable USB stick and boot your laptop. This automatically gives you the Volumio kiosk version, ie you do not need a web-interface to control Volumio, but you can do this directly on the laptop, which might be very useful for parties, for example.

Bonus 2:

To use Volumio as a Spotify alarm clock with the Standalone Spotify (SPOP), is a bit tricky. Volumio’s built-in alarm does not work with Spotify playlists…

Solution: cronjob! You have to install this first:

sudo apt-get install cron

With

crontab -e

you create a new crontab:

# weekdays
30 7 * * 1-5 /volumio/app/plugins/system_controller/volumio_command_line_client/volumio.sh next
15 8 * * 1-5 /volumio/app/plugins/system_controller/volumio_command_line_client/volumio.sh pause

#weekend
25 9 * * 6,7 /volumio/app/plugins/system_controller/volumio_command_line_client/volumio.sh next
30 10 * * 6,7 /volumio/app/plugins/system_controller/volumio_command_line_client/volumio.sh pause

In the example above,  your “alarm” goes off from 7:30 to 8:15 on weekdays, and at the weekend from 9:25 to 10:30.
If you have set / fixed the timezone as described before, you are good to go (with “date” you can check again, if your system time is correctly set).
Now you have to put the Spotify tracks or Spotify playlists (attention: Spotify playlists will be cropped from 100 tracks!) Into the queue of Volumio, and best set playback to random.
Finished! From now on you have a Spotify alarm clock! This also works with snapcast!

By the way: this is my wakeup playlist, split into 100-track parts so nothing is cropped when importing to the volumio queue: Part 1, Part 2, Part 3, Part 4, Part 5

 

Bonus 3:

I made “fade-in” scripts, to use volumio as a radio clock in the morning, to use via cron job:

Version 1: Controls via Snapcast volume (needs python)

Version 2: Controls the volumio volume via CLI commands