Audio streaming over Bluetooth

Bluetooth headsets have been around for a long time. First they were only useful for phone calls, but since the introduction of the A2DP standard a few years ago, the audio quality is good enough for stereo music.

Unfortunately, I don’t have an A2DP headphone. But there’s another useful application scenario for this technology: You have music on your cell phone and want to stream it to your stereo via a PC or home server.

It turns out that such a link is pretty easy to set up in Ubuntu. Here’s what I had to do on Ubuntu 11.04 (thanks to jprvita for the instructions):

  • Open /etc/bluetooth/audio.conf in an editor with root rights. Add the following line:
    Enable=Source
  • Type /etc/init.d/bluetooth restart to restart the Bluetooth service.
  • Pair your Bluetooth device with the computer.
  • Install the d-feet package.
  • Start d-feet and select File – Connect to System Bus.
  • Select org.bluez from the list and look for your paired device on the right side. It is called “dev_” followed by a MAC address.
  • Expand the org.bluez.AudioSource entry below your device.
  • Double-click the Connect() method and click Execute. You should now see a new audio device in the Ubuntu Sound Preferences.
  • To connect this device to your speakers, open pacmd in a terminal.
  • Type list-sources and list-sinks. In the respective lists, look for the Bluetooth audio source and the ALSA sink.
  • Type load-module module-loopback source=<BT source index> sink=<ALSA sink index>

If you play audio on your Bluetooth device, you should now hear it on your computer’s speakers.

I think this is especially useful if you have a little home server with an audio output, e.g. a D2 Plug. Then you can play music from yor laptop and/or your phone without using cables! You’d have to automate the whole connection process, but that shouldn’t be too hard.

Edit: Just thought of another useful application for this. Assume you have two laptops with a Bluetooth audio connection. If you install pavucontrol, you can choose which application uses which audio output, i.e. you can control the output of both laptops from one laptop. And there’s your hobby DJ setup: Connect one of the laptops to a headphone and one to the PA. Now you can listen to songs before you play them, without having to work on two laptops at once!

Another edit, Oct 13: Apparently there are stand-alone devices for this, e.g. the F8Z492cw Bluetooth Music Receiver from Belkin. In some cases that may be a better solution.

5 thoughts on “Audio streaming over Bluetooth

  1. Hi, I tried your steps on FC13. I can get audio to stream from my itouch to FC13 laptop. The device also shows up in pavucontrol. The only issue is that the audio stutters a lot. Any tips on how to resolve this? Is there some setting I am missing? Appreciate your help.

    • Hi,
      I’ve read that many users experienced stuttering especially in earlier releases. If you’re running Ubuntu 11.04 or an older version, I’d recommend you to install the current version of BlueZ from http://www.bluez.org.
      If you’re already using Ubuntu 11.10, check if your problem is listed here: https://bugs.launchpad.net/ubuntu/+source/bluez/+bugs – otherwise you’ll have to file a new bug. The problem could also be related to PulseAudio or other related packages.

      • Thanks. It works well with Ubuntu 11.10. Will try to upgrade bluez on FC13 and see if it resolves the issue for that distribution as well.

        • Oh, you’re running Fedora Core. Sorry, I didn’t recognize that abbreviation. I guess it would work on FC15, but of course you can try upgrading only bluez.

  2. Hi, I’ve wandering above the whole internet trying to get information about A2DP, technically, you’re completely right, but at the “Double-click the Connect() method and click Execute. You should now see a new audio device in the Ubuntu Sound Preferences.” step, I have a problem and I don’t know why, the cellphone connects to the computer or vice versa, but just for 1 or 2 seconds, then disconnects, and the /var/log/messages output just say “Unable to select SEP”, I really don’t know what it means, then I can’t see the new soundcard and so… Do you have some ideas for make it work ?

Leave a Reply

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>