• Stars
    star
    1,326
  • Rank 34,178 (Top 0.7 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Raspberry Pi Audio Receiver with Bluetooth A2DP, AirPlay 2, and Spotify Connect

Raspberry Pi Audio Receiver

A simple, light weight audio receiver with Bluetooth (A2DP), AirPlay 1, and Spotify Connect.

Features

Devices like phones, tablets and computers can play audio via this receiver.

Requirements

  • 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 11 Lite
  • Internal audio, HDMI, USB or I2S Audio adapter (tested with Adafruit USB Audio Adapter, pHAT DAC, and HifiBerry DAC+)

Again: do not try to use the internal Bluetooth chip, this will only bring you many hours of frustration.

⚠️ A note on Raspberry Pi OS 10 (Legacy)

The current version of Raspberry Pi OS (2022-01-28) is based on Debian 11 (Bullseye). This version does not contain the BlueALSA package (bluealsa) anymore. This repository now uses PulseAudio instead of ALSA. This may or may not work on slower devices like Raspberry Pi 1 and Raspberry Pi Zero.

For these devices, you might want to try HiFiBerryOS for similar functionality or stick with the debian-10 branch, which works with the "Raspberry Pi OS (Legacy)".

Installation

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
sudo ./install.sh

reboot

Basic setup

Lets you choose the hostname and the visible device name ("pretty hostname") which is displayed as Bluetooth name, in AirPlay clients and in Spotify.

Bluetooth

Sets up Bluetooth, adds a simple agent that accepts every connection, and enables audio playback through PulseAudio. A udev script is installed that disables discoverability while connected.

AirPlay 1

Installs Shairport Sync AirPlay Audio Receiver.

Spotify Connect

Installs Raspotify, an open source Spotify client for Raspberry Pi.

Read-only mode

To avoid SD card corruption when powering off, you can boot Raspberry Pi OS in read-only mode. This can be achieved using the raspi-config script.

Limitations

  • 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 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.

Wiki

There are some further examples, tweaks and how-tos in the GitHub Wiki.

Disclaimer

These scripts are tested and work on a current 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.

Upgrading

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.

Uninstallation

This project does not support uninstall at all. As stated above, it is meant to run on a dedicated device on a clean Raspberry Pi OS. If you choose to use this script along with other services on the same device, or install it on an already configured device, this can lead to unpredictable behaviour and can damage the existing installation permanently.

Contributing

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.

Related projects

As this project is kept very simple and opinionated, there are many forks and similar projects that are optimized for more specific requirements.

  • Arcaria197/rpi-audio-receiver - a fork that uses Raspbian 10 (legacy) and runs on Raspberry Pi Zero W hardware
  • HiFiBerryOS - a more sophisticated approach on this, using an entirely custom (buildroot) ecosystem

References

License

MIT

More Repositories

1

nginx-websocket-proxy

nginx WebSocket Proxy
340
star
2

hugo-theme-gallery

Gallery Theme for Hugo
JavaScript
211
star
3

Dyndns

A simple DynDNS server in PHP
PHP
99
star
4

node-monit

Node.js services with sysvinit and Monit
Shell
95
star
5

passport-apple

Sign in with Apple strategy for Passport
JavaScript
84
star
6

wamp.io

An implementation of the Autobahn WebSockets RPC/PubSub: WebSocket Application Messaging Protocol (WAMP) for WebSocket.IO or Engine.IO
JavaScript
79
star
7

node-init

A battle-tested solution for respawning node services on SysVinit-based (init.d) systems like Debian.
Shell
15
star
8

docker-koken

Docker container for Koken with Apache and PHP 7
PHP
13
star
9

php-oauth

Andy Smith's OAuth library, refactored for PHP 5.3
PHP
12
star
10

kaiser.gallery

JavaScript
12
star
11

bandoneon

A little JavaScript application that wants to help learning the bandoneon.
Vue
8
star
12

node-dyndns-server

A simple DynDNS server
JavaScript
8
star
13

rpi-camera-import

Raspberry Pi Camera Import
Python
7
star
14

koa-encrypted-session

Encrypted cookie session middleware extension for koa-session
JavaScript
5
star
15

oauth-provider-example

JavaScript
2
star
16

docker-batsd

Docker build file for Batsd (StatsD alternative)
2
star
17

doctrine-sandbox

A simple Sandbox for playing with Doctrine 2
PHP
2
star
18

hugo-gallery-example

Shell
2
star
19

http-status-cats

HTTP Status Cats (not only) for express
JavaScript
2
star
20

check-cert-expiry

Check expiration dates for SSL/TLS hosts
JavaScript
1
star
21

node-flashpolicy

Simple socket policy file server for Node.js
JavaScript
1
star
22

dotfiles

Dotfiles (public)
Shell
1
star