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 bluetooth

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

  1. Launch the Bluetooth control tool:
bluetoothctl
  1. Turn on the agent and start scanning for discoverable devices:
power on
agent on
default-agent
scan on
  1. Put your Bluetooth speaker into pairing mode.
  2. 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.
  3. 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
  1. 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:

  1. List your available audio outputs (sinks):
pactl list short sinks
  1. 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.wav

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