building   audio   linux
From 15.07.2018

Open Source Multi Room Speaker

I don’t like the overall user expiriance with Sonos. But like the way of listening to music. So I tried to get something open instead. I found the awesome snapcast and this is my setup.

server

  • Multi Room GUI: snapcastr
  • snapcast source/server
  • one or more audio sources:
    • (optional) Spotify Connect: librespot πŸ‘
    • (optional) WebPlayer: mopidy
    • (optional) AirPlay audio sink: https://github.com/mikebrady/shairport-sync
    • (optional) DLNA Renderer: gmediarender
  • (optional) snapcast sink/client

client

Hardware

I choose JustBoom as the HiFiBerry was to expensive in my opinion and I also felt kind of cheated by their β€œ60 W out”. I think Amp and Amp Zero are the same for mono?

In order to put the Amp to work you need:

  • ~15€ Raspberry Pi (Zero WH seems to be the cheapest option)
  • ~4€ SD Card (> 1 GB πŸ˜…)
  • ~18€ powersupply that can give more than the peak of the amplifier (+ a little for the Pi)
  • the actual speaker

I ended up with powersupplies from Mean Well (like this). Using these the standby consumption of a client (connected but not playing) seems to be below 0.1W 🀩

So each client costs at least 67€ plus the speaker.

Bathroom - 100€

Small watherproof WiFi speaker

Kitchen and Diningroom - each from 97€

Not so small WiFi speaker

  • ab 60€/2 Speaker
  • 67€ Base
  • 2€ muff for the Speaker
  • 2€ plug for the Amp

Bedroom - 6€

Utilized some old stuff.

Livingroom - 0€

Existing Home Cinnema as WiFi speaker. The audio receiver must be switched to the correct HDMI port manually (for now).

  • LivaX (any Pi would also work)
  • Onkyo TX-SR252

Garden - 55€

Because why not :) Also used as a BT-Device, see below.

  • Old ION - Audio Tailgater (50W)
  • 50€ Base without Powersupply

Config

All easy.

Clients

Raspbian Lite. Install the snapcast client and edit the following files:

File Why?
/boot/config.txt Enable the amp
/etc/asound.conf Mono Sound
/etc/networks/interfaces WiFi
/etc/wpa_sup WiFi
/etc/defaults/snapclient Hostname, ALSA Device to use
/etc/hostname Hostname

Enable the amp

/boot/config.txt

dtparam=audio=off
dtoverlay=justboom-dac

see https://support.hifiberry.com/hc/en-us/articles/205377651-Configuring-Linux-4-x-or-higher

Mono Sound

/etc/asound.conf

pcm.!default makemono

pcm.makemono {
    type route
    slave.pcm "hw:0"
    ttable {
        0.0 1    # in-channel 0, out-channel 0, 100% volume
        1.0 1    # in-channel 1, out-channel 0, 100% volume
    }
}

see https://superuser.com/questions/155522/force-downmix-to-mono-on-linux or https://www.justboom.co/tutorials/configure-justboom-amps-mono/

Bluetooth

You might also want to connect via Bluetooth. bt-speaker@3f49801 with BTtoggle.py works great. It needs the following config.ini for the justboom:

[bt_speaker]
connect_command = /etc/bt_speaker/hooks/connect
disconnect_command = /etc/bt_speaker/hooks/disconnect

[bluez]
device_path = /org/bluez/hci0
discoverable = yes

[alsa]
enabled = yes
mixer = Digital
id = 0
cardindex = 0
device = makemono

Server

snapcast

See their instructions.

librespot

git clone https://github.com/librespot-org/librespot
cd librespot/
cargo build --release --features "alsa-backend"

gmediarender

sudo apt install gmediarender
pacmd load-module module-pipe-sink file=/tmp/snapfifo sink_name=Snapcast rate=48000
pacmd update-sink-proplist Snapcast device.description=Snapcast
gmediarender --gstout-audiosink=pulsesink --gstout-audiodevice=Snapcast -f Snapcast -d

snapcastr

If you serve snapcastr with lighttpd. You could just run it in flask. But you don’t need to spend another port if you run a webserver anyway.

/etc/lighttpd/conf-enabled/10-fastcgi.conf
sudo pip3 install --system flask
sudo pip3 install --system flask-bootstrap
sudo pip3 install --system flask-nav
sudo pip3 install --system wtforms
sudo pip3 install --system snapcast

Links