... and why XBMC does not support Bluetooth speakers

My goal was to get my Bose SoundLink Bluetooth speakers to work with XBMC on the Raspberry PI. The speakers are working very well with ALSA, but unfortunately XBMC cannot use them properly (and will continue to be unable to do so for quite a while longer).

Here's why

On the PI, XBMC needs hardware acceleration to be able to decode HD audio. This can be done, since the PI has a Broadcom chip that allows audio decoding via the GPU. Yet, in order to use this chip, XBMC has to use OpenMAX, not ALSA or PulseAudio (source).

To do so, it uses omxplayer, which is compiled directly into the XBMC binary (source). There are several versions of the OpenMAX API, but in order to talk to the Broadcom chip, XBMC must use the Broadcom implementation (obviously). The open source implementation (called Bellagio has an ALSA sink, which allows it to just stream the audio content to ALSA, but the Broadcom implementation hasn't (source). And since it's not open source, there's really no chance of it ever getting one.

So now you see: Bluetooth speakers on the RPi just won't happen on that front. There are attempts to use ALSA directly, such as this dirty hack, but it has severe problems keeping the audio in sync with the video, so it's basically unusable.

If you want to know how to setup Bluetooth speakers with ALSA on the PI anyways, keep reading.

ALSA Bluetooth Setup

I am using the latest Raspbmc image. Start by installing all necessary software.

sudo apt-get install bluez blueman xauth alsa-utils bluez-alsa mplayer

Then edit /etc/bluetooth/audio.conf and add


Some people reported that when using bluez > 4.96, the following should be used instead:


Restart bluetooth to accept those changes:

sudo service bluetooth restart

SSH into your PI with X forwarding (works only from systems that have an X server running!) and start blueman:

ssh -X blueman-manager
  1. Turn on the SoundLink
  2. Long-press its Bluetooth button (3s) until it is in discovery mode
  3. Wait for it to appear in blueman
  4. Note down its MAC address (looks like XX:XX:XX:XX:XX:XX)
  5. Right-click it: Add Device
  6. Right-click it: Pair
  7. Right-click it: Trust
  8. Right-click it: Add Audio Sink

Finally edit /etc/asound.conf and add:

pcm.!default {
    type bluetooth
    device 00:02:3C:26:BA:87 # change this MAC address to the one you wrote down
    profile "auto"}

This should do the trick. Try it out using:

mplayer -ao alsa http://robtowns.com/music/blind_willie.mp3

Possible errors

Can't discover or connect to the SoundLink

Long-press its mute-key until the indicator lights flash. Then turn it on again and re-enter discovery mode.

blueman: Stream setup failed

Make sure /etc/bluetooth/audio.conf contains Enable=Socket

sudo service bluetooth restart

Remove the device from blueman, then long-press the mute-key until the indicator lights flash. Then turn it on again and re-enter discovery mode. Try adding it again now.