Improving my crappy Snapcast setup
2023-05-13
About a month ago, I introduced you to the amazing open source multi-room audio player Snapcast , but only presented a very minimal, crappy setup. Today, we are changing this, as I want to share my new and improved setup...
This time around, I opted for a Raspberry Pi as the dedicated head of operation and want to be able to connect to it just like you know it from a normal Bluetooth/AirPlay speaker, which then distributes the signal to all connected clients. The Pi therefore needs to run the Snapcast server along with a piece of software that handles the signal input. I chose Cornrow , which is a hassle-free Bluetooth audio daemon for single-board computers (SBCs), and couldn't be happier with it. The clients are still the same amazing and zero-setup apps available for almost all platforms plus the Pi itself (via the audio jack), if you want. The whole structure of my setup can be seen below:
Here is how to set everything up just like I have it:
- Flash a fresh Raspberry Pi OS Lite image to an SD card via the RPI Imager (enable SSH and enter Wi-Fi credentials to connect to it right away)
-
Connect to the system via
ssh USERNAME@HOSTNAME.local
-
Update the system via
sudo apt update && sudo apt full-upgrade -y
-
Update the firmware via
sudo rpi-update
-
Install snapserver from the repositories via
sudo apt install snapserver -y
(the service should be enabled automatically) -
Install Cornrow this way:
-
Download the newest .deb package from GitHub via
wget https://github.com/mincequi/cornrow/releases/download/v0.8.1/cornrowd_0.8.1_armhf.deb
-
Install it via
sudo apt install ./cornrowd_0.8.1_armhf.deb -y
-
Set up the service via
sudo systemctl unmask cornrowd.service && sudo systemctl enable cornrowd.service
-
Download the newest .deb package from GitHub via
-
Modify the Cornrow config to use AirPlay and stream to a local TCP connection:
[bluetooth_source]
codecs = [ 0x0 ]
sample_rates = [ 44100, 44800 ]
[airplay_source]
name = "musicpi"
port = 0
buffer_time = 2000
#[alsa_sink]
#device = "default"
[tcp_sink]
host = "127.0.0.1"
port = 4953 -
Modify the Snapcast config to accept the TCP stream:
[stream]
#source = pipe:///tmp/snapfifo?name=default
source = tcp://127.0.0.1:4953?name=musicpi&sampleformat=44100:16:2 -
If you have problems to connect to the Raspi after deleting the pairing from your client device
(like an Android phone), unpair it from the server as follows:
-
Hop into
bluetoothctl
-
List all paired devices in the new prompt via
paired-devices
-
Unpair all misbehaving devices by finding their MAC address (format
aa:bb:cc:dd:ee:ff
) and removing them viaremove MACADDRESS
-
Hop into
-
If you want to Raspi to output audio via it's audiojack too, simply install the client there as well
via
sudo apt install snapclient -y
(the service should be enabled automatically) - Reboot the Pi and enjoy this simple, but amazing setup
With that said, consider giving it a try yourself and have a lovely day...