ALL CREDITS TO @badaix AND @BaReinhard
This will setup a raspberry-pi-3 as a snapcast-server and snapcast-client.
Possible music sources for the snapserver-component: Bluetooth, Airplay, Spotify, Line-In (more to come eg. RTP)
Music sinks (snapclients): usb soundcard connected to my stereo, another Pi
To Do:
- Energy saving by disabling onboard bluetooth, wifi and soundcard
SYSTEM ENVIRONMENT
- 2017-07-05-raspbian-jessie-lite.img
- rpi3, logilink-usb-bt-dongle, usb-soundcard
sudo raspi-config
PREPARE, INSTALL AND CONFIGURE BLUTOOTH AND AIRPLAY FUNCTIONALITY (SSRPARI)
sudo apt update
sudo apt upgrade
sudo apt install git
git clone https://github.com/BaReinhard/Super-Simple-Raspberry-Pi-Audio-Receiver-Install.git
cd Super-Simple-Raspberry-Pi-Audio-Receiver-Install/
sudo ./install.sh
# Do you want to install SnapCast? (y/n): n
# Do you want AirPlay Enabled? (y/n) : y
# Do you want Bluetooth A2DP Enabled? (y/n) : y
# Do you want to setup as an Access Point? (Necessary for AirPlay, in location without a Wireless Network) (y/n) : n
# Do you want Kodi installed? (y/n) : n
# Do you want to use infrared remotes? (y/n) : n
# Do you want to use a Sound Card? (y/n) : y
# Do you want to setup device as a UPnP Renderer? (y/n) : n
# Do you want all the Devices to use the same name? (y/n) : y
# Device name: MultiPi
# Do you want to use an AirPlay password? (y/n) : n
# (...)
# 9. USB Sound Card
# (...)
# Which Sound Card are you using? (0/1/2/3/4/5/6/7/8/9/10/11) : 9
wget https://github.com/badaix/snapcast/releases/download/v0.15.0/snapserver_0.15.0_armhf.deb
sudo dpkg -i snapserver_0.15.0_armhf.deb
sudo apt-get -f install
wget https://github.com/badaix/snapcast/releases/download/v0.15.0/snapclient_0.15.0_armhf.deb
sudo dpkg -i snapclient_0.15.0_armhf.deb
# LIST SOUNDCARDS
snapclient --list
# CONFIGURE SNAPCLIENT
sudo nano /etc/default/snapclient
# EDIT SNAPCLIENT_OPTS=""
# -h <HOST> -s <SOUNDCARD> -d <DAEMONIZE>
# SNAPCLIENT_OPTS="-h localhost -s 25 -d"
sudo systemctl restart snapclient.service
# CREATE SNAPCAST-STREAM = NEW PULSEAUDIO-SINK
sudo nano /etc/default/snapserver
# EDIT
# #SNAPSERVER_OPTS=""
# SNAPSERVER_OPTS="-d -b 250 --sampleformat 48000:16:2 -s pipe:///tmp/snap_blue?name=Bluetooth&sampleformat=44100:16:2&mode=read"
# CREATE SYSTEMWIDE PULSEAUDIO-PIPE-SINK
sudo nano /etc/pulse/system.pa
# APPEND
# load-module module-pipe-sink file=/tmp/snap_blue sink_name=bluetooth
# ASSIGN SINK TO [Bluetooth-Sources](https://github.com/BaReinhard/Super-Simple-Raspberry-Pi-Audio-Receiver-Install/issues/6#issuecomment-284573272)
sudo nano /usr/local/bin/bluez-udev
# EDIT
# #audio_sink=0
# audio_sink=1
sudo reboot
BUILD, CONFIGURE LIBRESPOT
sudo apt-get install build-essential portaudio19-dev git
curl https://sh.rustup.rs -sSf | sh
sudo reboot
git clone https://github.com/librespot-org/librespot.git
cd librespot/
cargo build --release
$PATH
sudo cp target/release/librespot /usr/bin
# CREATE SNAPCAST-STREAM
sudo nano /etc/default/snapserver
# APPEND
# SNAPSERVER_OPTS=" ... -s spotify:///librespot?name=Spotify&username=username&password=yourpassword&devicename=SpotiPI&bitrate=320 ... "
sudo systemctl restart snapserver.service
BUILD, EDIT AND ENABLE CPIPED FOR LINE-IN AUDIO
git clone https://github.com/b-fitzpatrick/cpiped.git
cd cpiped/
make
sudo cp cpiped /usr/local/bin/
# FIND CAPTURE DEVICE/LINE-IN
arecord -L
nano scripts/init.d/cpiped
# EDIT DAEMON-VARIABLES
# DAEMON=/usr/local/bin/cpiped # LOCATION OF THE BINARY
# DAEMON_ARGS="-D -d sysdefault:CARD=Set /tmp/snap_jack" # LOCATION OF THE PIPE
sudo cp cpiped /etc/init.d/
sudo chmod +x /etc/init.d/cpiped
sudo systemctl enable cpiped
sudo systemctl start cpiped
# CREATE SNAPCAST-STREAM
sudo nano /etc/default/snapserver
# EDIT
# #SNAPSERVER_OPTS=""
# SNAPSERVER_OPTS="-d -b 250 --sampleformat 44100:16:2 -s pipe:///tmp/snap_jack?name=Jack&sampleformat=44100:16:2 -s pipe:///tmp/snap_blue?name=Bluetooth&mode=read&sampleformat=44100:16:2 -s spotify:///librespot?name=Spotify&username=username&password=yourpassword&devicename=SpotiPI&bitrate=320"
CONFIGURE AIRPLAY
# CREATE SNAPCAST-STREAM
sudo nano /etc/default/snapserver
# APPEND
# SNAPSERVER_OPTS=" ... -s airplay:///shairport-sync?name=Airplay&devicename=MultiPi&port=5000 ... "
sudo systemctl disable shaiport-sync
sudo nano /etc/shairport-sync.conf
# EDIT
# //output_backend = "alsa";
# output_backend = "stdout";
switched to librespot-org
switched to snapcast_v13