One-time setup, zero maintenance Bluetooth audio bridge
- Flash fresh Raspberry Pi OS Lite 32-bit
- Run:
scp Installer.sh pi@192.168.0.233:~/ && ssh pi@192.168.0.233 "chmod +x Installer.sh && ./Installer.sh" - Reboot with
sudo reboot - That's it!
- On Ubuntu system:
./scripts/universal-setup.sh - Run scripts manually in separate terminals:
python3 /opt/snapcast-bt-bridge/scripts/auto_loopback.py &python3 /opt/snapcast-bt-bridge/scripts/stream_to_snapcast.py &
- That's it!
- ✅ Plug in Pi → boots up and ready
- ✅ Pair phone once → auto-connects every time after
- ✅ Play music → automatically routes to Snapcast server
- ✅ No manual commands ever needed
The auto-loopback service constantly monitors for Bluetooth connections and creates the audio routing automatically. Your phone becomes a wireless audio source for your entire Snapcast multi-room audio system.
This project turns a Raspberry Pi or Ubuntu Linux system into a Bluetooth A2DP receiver that forwards audio to your Snapcast server.
Audio Flow:
Android Phone → Bluetooth A2DP → Raspberry Pi/Ubuntu → TCP Stream → Snapcast Server → All Speakers
Configuration:
- Device: Acts as Bluetooth audio receiver (A2DP sink)
- Snapcast Server:
192.168.0.30:4951(configure inInstaller.shorstream_to_snapcast.py) - Audio Format: 48kHz, 16-bit, stereo
- Pairing: Automatic (Pi) or manual (Ubuntu), no PIN required
Phone (Bluetooth Source)
↓ A2DP (aptX/SBC codec)
Raspberry Pi/Ubuntu (PulseAudio + BlueZ)
↓ TCP Stream (s16le, 48kHz, 2ch)
Snapcast Server (192.168.0.30:4951)
↓ Snapcast Protocol
All Connected Speakers
- Raspberry Pi 3B+ or newer (with built-in Bluetooth) OR Ubuntu Linux system with Bluetooth adapter
- Android phone or Bluetooth audio source
- Network connection to Snapcast server
- Raspberry Pi: Raspberry Pi OS Lite 32-bit (fresh install) - automatically installs: bluetooth, bluez, pulseaudio, python3
- Ubuntu Linux: Ubuntu 20.04+ with PulseAudio - automatically installs: bluetooth, bluez, pulseaudio, python3
Run the Installer.sh script on a freshly flashed Raspberry Pi:
# From your computer
scp Installer.sh pi@192.168.0.233:~/ && ssh pi@192.168.0.233 "chmod +x Installer.sh && ./Installer.sh"The script automatically:
- Installs all required packages
- Disables PipeWire (uses PulseAudio instead)
- Configures Bluetooth as A2DP receiver
- Sets up automatic pairing (no PIN)
- Creates auto-loopback service
- Starts streaming to Snapcast server
Configuration: Edit the Snapcast server IP in the script before running (default: 192.168.0.30:4951)
Important: Reboot after installation with sudo reboot
Run the scripts/universal-setup.sh script on your Ubuntu system:
./scripts/universal-setup.shThe script automatically detects your audio setup (PulseAudio or PipeWire) and:
- Creates the Snapcast null sink (
snapcast_to_bluetooth) - Sets it as the default sink
- Loads Bluetooth modules (if PulseAudio with Bluetooth support)
- Prepares for manual script operation
Manual pairing: Use bluetoothctl to pair your device:
bluetoothctl
power on
scan on
pair <MAC_ADDRESS>
trust <MAC_ADDRESS>
connect <MAC_ADDRESS>Manual operation: Run the scripts in separate terminals:
python3 /opt/snapcast-bt-bridge/scripts/auto_loopback.py &(monitors Bluetooth connections)python3 /opt/snapcast-bt-bridge/scripts/stream_to_snapcast.py &(streams audio to Snapcast)
Configuration: Edit the Snapcast server IP in stream_to_snapcast.py (default: 192.168.0.30:4951)
Your Snapcast server must have this source configured:
[stream]
source = tcp://0.0.0.0:4951?name=BLUETOOTH&sampleformat=48000:16:2&mode=serverThis makes the server listen for incoming TCP connections from the Raspberry Pi or Ubuntu system.
- Flash Raspberry Pi OS Lite 32-bit
- Run
Installer.sh(see Installation above) - Wait for setup to complete (~5-10 minutes)
- Reboot with
sudo reboot - On your phone: Go to Bluetooth settings
- Find and pair with the Bluetooth device (no PIN needed)
- Play music on your phone
- Power on Raspberry Pi (automatic startup)
- Phone auto-connects when in range
- Play music → automatically streams to all Snapcast speakers
- That's it!
bt-agent.service- Automatic Bluetooth pairingauto-loopback.service- Automatic audio routingsnapcast-bt-stream.service- TCP streaming to Snapcast server
Check status:
sudo systemctl status bt-agent auto-loopback snapcast-bt-stream- Run
scripts/universal-setup.sh(see Installation above) - Pair your Bluetooth device using
bluetoothctl(see Installation above) - Open two terminals:
- Terminal 1:
python3 /opt/snapcast-bt-bridge/scripts/auto_loopback.py & - Terminal 2:
python3 /opt/snapcast-bt-bridge/scripts/stream_to_snapcast.py &
- Terminal 1:
- Play music on your phone
- Run the two Python scripts in separate terminals when needed
- Phone auto-connects when in range (if previously paired)
- Play music → streams to all Snapcast speakers
- Close terminals when done
auto_loopback.py- Monitors Bluetooth connections and sets up audio routingstream_to_snapcast.py- Streams audio to Snapcast server
ssh pi@192.168.0.233
sudo systemctl restart bt-agent bluetooth
bluetoothctl discoverable on# Check if Bluetooth source is detected
ssh pi@192.168.0.233 "pactl list sources short | grep bluez"
# Restart auto-loopback service
ssh pi@192.168.0.233 "sudo systemctl restart auto-loopback"# Auto-loopback service
sudo journalctl -u auto-loopback -f
# Streaming service
sudo journalctl -u snapcast-bt-stream -f
# Bluetooth pairing
sudo journalctl -u bt-agent -fssh pi@192.168.0.233
sudo systemctl restart bluetooth bt-agent auto-loopback snapcast-bt-streamInstaller.sh- Raspberry Pi automated setup scriptscripts/universal-setup.sh- Universal setup for Linux systems
configs/bluetooth/main.conf- Bluetooth A2DP receiver configurationconfigs/pulseaudio/system.pa- PulseAudio Bluetooth modulesscripts/simple_agent.py- Auto-pairing agent (no PIN)scripts/stream_to_snapcast.py- TCP audio streamerscripts/auto_loopback.py- Automatic audio routingsystemd/*.service- Service files for automatic startup
SETUP_COMPLETE.md- Technical documentation of working systemQUICK_START.md- Daily usage guideREFLASH_GUIDE.md- Step-by-step reflash instructionsPROJECT_COMPLETE.md- Complete project overview
install.sh- Original installation script (deprecated)fresh-install.sh- Previous Raspberry Pi script (replaced by Installer.sh)make-it-work.sh- Simplified version (use Installer.sh instead)
- Bluetooth A2DP: Phone connects as audio source
- PulseAudio: Receives Bluetooth audio via bluez5 modules
- module-loopback: Routes
bluez_source→snapcast_to_bluetoothsink - parec: Captures from
snapcast_to_bluetooth.monitor - TCP Stream: Sends s16le/48kHz/2ch to Snapcast server
- Snapcast: Distributes to all connected clients/speakers
- PulseAudio (not PipeWire - PipeWire is disabled)
- BlueZ 5.82+ for Bluetooth stack
- Python D-Bus for automatic pairing
- systemd for service management
PipeWire's Bluetooth A2DP sink support is incomplete on Raspberry Pi. PulseAudio has mature, stable Bluetooth modules that properly handle A2DP receiver mode.
✅ Raspberry Pi: Device boots and services start automatically
✅ Ubuntu: Scripts run without errors in terminals
✅ Phone pairs without PIN prompt
✅ pactl list sources short shows bluez_source...RUNNING
✅ pactl list sinks short shows snapcast_to_bluetooth...RUNNING
✅ Music plays through all Snapcast speakers
✅ Auto-reconnects when phone comes back in range
MIT License - See LICENSE file for details.
Tested and working configuration as of October 23, 2025
Raspberry Pi: Raspberry Pi OS Lite 32-bit (Debian Bookworm/Trixie)
Ubuntu Linux: Ubuntu 20.04+ with PulseAudio
PulseAudio 17.0, BlueZ 5.82, Python 3.13