A simple, light weight audio receiver with Bluetooth (A2DP), AirPlay, Spotify Connect and UPnP.
Devices like phones, tablets and computers can play audio via this receiver.
- A USB Bluetooth dongle (the internal Raspberry Pi Bluetooth chipset turned out as not suited for audio playback and causes all kinds of strange connectivity problems)
- Raspberry Pi OS Buster Lite (tested with August 2020 version)
- Internal audio, HDMI, USB or I2S Audio adapter (tested with Adafruit USB Audio Adapter, pHAT DAC, and HifiBerry DAC+)
The installation script asks whether to install each component.
wget -q https://github.com/nicokaiser/rpi-audio-receiver/archive/main.zip
unzip main.zip
rm main.zip
cd rpi-audio-receiver-main
./install.sh
Lets you choose the hostname and the visible device name ("pretty hostname") which is displayed as Bluetooth name, in AirPlay clients and in Spotify.
Sets up Bluetooth, adds a simple agent that accepts every connection, and enables audio playback through BlueALSA. A udev script is installed that disables discoverability while connected.
Installs Shairport Sync AirPlay Audio Receiver.
This script comes with a backported version of shairport-sync from Raspberry Pi OS Bullseye (see SimpleBackportCreation for details) and can be replaced with the original (but older) one in Raspberry Pi OS Buster or a sef-compiled one (not part of this project).
Installs Raspotify, an open source Spotify client for Raspberry Pi.
Installs gmrender-resurrect UPnP Renderer.
Installs snapclient, the client component of the Snapcast Synchronous multi-room audio player.
To avoid SD card corruption when powering off, you can boot Raspberry Pi OS in read-only mode. This is described by Adafruit in this tutorial and cannot be undone.
- Only one Bluetooth device can be connected at a time, otherwise interruptions may occur.
- The device is always open, new clients can connect at any time without authentication.
- To permanently save paired devices when using read-only mode, the Raspberry has to be switched to read-write mode (
mount -o remount,rw /
) until all devices have been paired once. - You might want to use a Bluetooth USB dongle or have the script disable Wi-Fi while connected (see
bluetooth-udev
), as the BCM43438 (Raspberry Pi 3, Zero W) has severe problems with both switched on, see raspberrypi/linux/#1402. - The Pi Zero may not be powerful enough to play 192 kHz audio, you may want to change the values in
/etc/asound.conf
accordingly.
There are some further examples, tweaks and how-tos in the GitHub Wiki.
These scripts are tested and work on a current (as of September 2020) Raspberry Pi OS setup on Raspberry Pi. Depending on your setup (board, configuration, sound module, Bluetooth adapter) and your preferences, you might need to adjust the scripts. They are held as simple as possible and can be used as a starting point for additional adjustments.
This project does not really support upgrading to newer versions of this script. It is meant to be adjusted to your needs and run on a clean Raspberry Pi OS install. When something goes wrong, the easiest way is to just wipe the SD card and start over. Since apart from Bluetooth pairing information all parts are stateless, this should be ok.
Updating the system using apt-get upgrade
should work however.
Package and configuration choices are quite opinionated but as close to the Debian defaults as possible. Customizations can be made by modifying the scripts, but the installer should stay as simple as possible, with as few choices as possible. That said, pull requests and suggestions are of course always welcome. However I might decide not to merge changes that add too much complexity.
- BlueALSA: Bluetooth Audio ALSA Backend
- Shairport Sync: AirPlay Audio Receiver
- Raspotify: Spotify Connect client for the Raspberry Pi that Just Works™
- gmrender-resurrect: Headless UPnP Renderer
- Snapcast: Synchronous audio player
- pivumeter: ALSA plugin for displaying VU meters on various Raspberry Pi add-ons
- Adafruit: Read-Only Raspberry Pi