Using A2DP Bluetooth in Kubuntu Karmic

I‘ve been using Kubuntu Karmic on my ASUS G1s notebook for a couple of weeks now and I’m quite happy with it. On the most part, everything “just works”.

One thing that didn’t work out of the box though, was my A2DP bluetooth headset. I have a Nokia BH-503 that I use quite often while I’m working so it’s something I really wanted to get work. Unfortunately, the KDE desktop widget for managing bluetooth still leaves a lot to be desired. At the moment it really only manages input devices, such as bluetooth mice. I found a pretty easy work around though.

Step 1: Install gnome-bluetooth because kbluetooth is lame (for now)

Now, because kbluetooth is pretty lame when it comes to this stuff, the easiest thing for us to do is ditch it and install gnome-bluetooth which is a lot more mature and can set up devices other than input devices. So:

sudo apt-get install gnome-bluetooth

It will probably try and install some other stuff that it needs, so let it. Once that’s done, you’ll need to run it manually to start it up as it won’t put anything in KMenu.

Step 2: Run gnome-bluetooth and pair your device

Running it is easy, despite the executable not being called gnome-bluetooth. Just run:

bluetooth-applet

and it will popup in the widget tray. Left click on it and select Setup new device. Just follow the wizard and pair your device. This will be different for every device so I won’t go into any detail here, other than to say, put your device is discover mode and it should find it.

Once it’s found it, you should see your headset in the devices list of gnome-bluetooth’s popup menu. Strangely enough, that’s all we need gnome-bluetooth for. You can now pretend it doesn’t exist for all intents and purposes (you can even uninstall it if you really want. I did).

NOTE: Funnily enough, if you still have kbluetooth running you can see your A2DP audio device in the devices list in there too!!!

Step 3: Get PulseAudio up and running

To get the audio component working, we need something can intercept the audio and send it to the headset. This used to be done with bluetooth-alsa which was part of the BlueZ project. But this required a whole lot of messing around with config files and once it was setup, you had to manually switch between audio output devices should you want to use something besides your headset.

The elegant solution is to use PulseAudio to handle audio in KDE. This is really easy to get up and running and pretty much just requires you to install the pulseaudio and pulseaudio-module-bluetooth packages and reboot so everything starts up correctly. There’s also a bunch of config utils that make working with PulseAudio a lot easier so we’ll install them too. So from a command line, simply:

sudo apt-get install pulseaudio pulseaudio-module-bluetooth padevchooser paman paprefs

Of course, this will probably try and install a whole bunch of other dependencies, so just let it. As far as I can tell it’s all just libraries and stuff. Once this is done, it easiest just to reboot and let pulseaudio start up and load all it’s modules.

Step 4: Listen to music

That’s pretty much it. Once you have rebooted you can log back in and just set your audio device to use PulseAudio (in system settings). Initially your audio will still come out of your default device, but if you run pavucontrol or from kMenu Pulse Audio Volume Control you have complete control over everywhere your audio comes from and goes to. Pulse is actually pretty cool.

Anywayz, if everything worked, in pvaucontrol the Configuration tab should show your A2DP device. If it has selected the HSP profile in the dropdown box, simply select the A2DP (it will remember this). Now, while audio is playing you should be able to select your headset as the audio output device.

Alternatively, you can setup and use padevchooser to select your audio server and output device, but I’ll leave that for a later post.

The coolest part of all this is that PulseAudio will seamlessly switch between output devices. For example, I have my A2DP headset set up as my default device for Amarok. So I can start playing music and it will come out my crappy laptop speakers. But if I turn on my headset and it connects the audio will automatically switch to there. I don’t even have to stop the currently playing audio track! The opposite also works where if I turn off my headset, audio switches back to my speakers. Pretty cool!

Hope this helps someone out there.

2 Comments

  1. Leo
    Jun 14, 2011

    Thanks a lot! Helped really much! BTW, the Arch Linux wiki page on bluetooth audio headset basically redirects to this one :D

    • jamie
      Jul 14, 2011

      I actually consider this article to be obsolete now. I use Kubuntu Natty now and it takes care of BT headsets out of the box, which is cool.

Submit a Comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>