How to Route Raspberry Pi Audio to Bluetooth
Configuring your Raspberry Pi to stream all audio through a paired Bluetooth speaker is a great way to cut the cords on your media projects. While older versions of Raspberry Pi OS required complex manual setup via PulseAudio or ALSA, modern versions built on Debian (like Bullseye and Bookworm) utilize PipeWire or PulseAudio natively, making the transition seamless. This guide will walk you through pairing your Bluetooth speaker, setting it as your default audio sink, and troubleshooting common connection issues.
Step 1: Prepare Your Raspberry Pi
Before connecting your device, ensure your Raspberry Pi is fully updated and the necessary Bluetooth packages are active. Open your terminal and run the following commands:
sudo apt update
sudo apt upgrade -y
sudo systemctl enable --now bluetoothStep 2: Pair and Connect Your Bluetooth Speaker
You can manage your Bluetooth connections via the Desktop GUI or the
command line. Using the terminal tool bluetoothctl is the
most reliable method across all Raspberry Pi setups.
- Launch the Bluetooth control tool:
bluetoothctl- Turn on the agent and start scanning for discoverable devices:
power on
agent on
default-agent
scan on- Put your Bluetooth speaker into pairing mode.
- Look for your speaker in the terminal output; it will display a MAC
address (e.g.,
20:19:AB:CD:EF:01) alongside its name. - Pair, trust, and connect to your speaker using its MAC address:
pair 20:19:AB:CD:EF:01
trust 20:19:AB:CD:EF:01
connect 20:19:AB:CD:EF:01- Exit the utility by typing
exit.
Step 3: Route Audio to the Bluetooth Speaker
Once connected, you need to tell the Raspberry Pi to route all system audio to the Bluetooth speaker instead of the HDMI port or the 3.5mm audio jack.
Method A: Using the Desktop GUI
If you are using the Raspberry Pi Desktop interface, simply right-click the volume icon in the top-right corner of the taskbar. Select your paired Bluetooth speaker from the dropdown menu to set it as the active audio output.
Method B: Using the Command Line (PipeWire/PulseAudio)
For headless setups or command-line preferences, you can set the
default audio route using wpctl (for PipeWire on newer OS
versions) or pactl (for PulseAudio).
To set the default output via PulseAudio/PipeWire:
- List your available audio outputs (sinks):
pactl list short sinks- Identify your Bluetooth speaker from the list, then set it as the default system sink:
pactl set-default-sink bluez_output.20_19_AB_CD_EF_01.a2dp-sink(Note: Replace the sink name with the exact one generated for your device, swapping colons for underscores if necessary).
Step 4: Test the Audio Configuration
To verify that the audio routing is working correctly, play a test
sound file through the terminal using aplay or
paplay:
paplay /usr/share/sounds/alsa/Front_Center.wavIf you hear the audio clearly from your Bluetooth speaker, the configuration is complete and your Raspberry Pi will now route all system sounds, media players, and browser audio through the connected Bluetooth device.