Raspberry Pi network audio player: pulseaudio, DLNA and bluetooth A2DP – part 3: bluetooth


raspberry pi + bluetooth logoThis article is part 3 of 3, where I cover configuring Raspberry Pi as A2DP bluetooth speaker(s). Parts 1 and 2 focus on setting up pulseaudio over network, and a DLNA renderer role for the Pi respectively. In the end you get a multi-protocol audio-playing Raspberry Pi.

Installation

To use your Pi as a bluetooth speaker you will need a bluetooth dongle. And then, need to install bluez, as well as bluetooth module for pulseaudio:

$ sudo aptitude -P install bluez pulseaudio-module-bluetooth python-gobject python-gobject-2

You will also need to add user pi to the lp group (this seems to be required to be able to talk to bluetooth daemon):

$ sudo usermod -a -G lp pi

Now you need to configure your bluetooth host for audio by setting up:

Enable=Source,Sink,Media,Socket

in /etc/bluetooth/audio.conf file. There is also a recommendation to adjust resampling method in pulseaudio:

resample-method = trivial

in /etc/pulse/daemon.conf file. Make sure you have module-bluetooth-discover lines uncommented in /etc/pulse/default.pa. When done, you might want to reboot and see whether bluetooth comes up at boot, and pulseaudio loads the bluetooth module (see my previous article for more information about pulseaudio with Raspberry Pi). To test, issue:

$ hcitool scan
Scanning ...
xx:xx:xx:xx:xx:xx       phone

If you get similar output, bluetooth works as expected.

Pairing

Now you need to pair your phone (or other source of audio) with your Pi. Your phone’s bluetooth MAC is provided as xx:xx:xx:xx:xx:xx throughout the article. Setting up the Pi to be visible first will be helpful:

$ sudo hciconfig hci0 piscan

Now, run the bluetooth agent (providing basic functions, together with dbus):

$ bluez-simple-agent
Agent registered

Grab your phone, search for devices, select raspberrypi-0 (this is the default bluetooth name for your Pi, you can change it), and start pairing. At the terminal where agent is running, you will answer two questions during the process:

RequestPinCode (/org/bluez/1981/hci0/dev_xx_xx_xx_xx_xx_xx)
Enter PIN Code: <put-your-pin-here>
Authorize (/org/bluez/1981/hci0/dev_xx_xx_xx_xx_xx_xx, )
Authorize connection (yes/no): yes
Cancel
Release

Pairing done. Now you should mark your phone as a trusted device, so that you do not need to confirm its connection (not particularly comfortable with a headless Pi) every time:

$ bluez-test-device trusted xx:xx:xx:xx:xx:xx yes

When you connect the phone you should see this in your logs:

Feb 12 23:01:59 raspberrypi kernel: [ 2040.500081] input: xx:xx:xx:xx:xx:xx as /devices/virtual/input/input0

Tip: If you need to remove the pairing from your Pi (for trial and error with stubborn setups), try this:

$ bluez-simple-agent hci0 xx:xx:xx:xx:xx:xx remove

Setting up pulseaudio

At this point, when you connect your phone, the audio might not work yet and your logs may look like this:

Feb 13 00:52:02 raspberrypi bluetoothd[2003]: input-headset driver probe failed for device xx:xx:xx:xx:xx:xx
Feb 13 00:52:02 raspberrypi pulseaudio[2236]: [pulseaudio] bluetooth-util.c: org.bluez.AudioSource.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.AudioSource" doesn't exist
Feb 13 00:52:02 raspberrypi pulseaudio[2236]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.HandsfreeGateway" doesn't exist
Feb 13 00:52:02 raspberrypi pulseaudio[2236]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.HandsfreeGateway" doesn't exist
Feb 13 00:52:02 raspberrypi pulseaudio[2236]: [pulseaudio] bluetooth-util.c: org.bluez.Audio.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.Audio" doesn't exist

I was hit by this. A reboot solved the issue; most probably it was a pulseaudio+dbus+bluetooth thing, and restarting them all would help, but I went the lame way. The desired result will appear here:

$ pactl list short | grep blue
6       module-bluetooth-discover
90      module-bluetooth-device address="xx:xx:xx:xx:xx:xx" path="/org/bluez/1903/hci0/dev_xx_xx_xx_xx_xx_xx" profile="a2dp_source" auto_connect=no
34      bluez_source.xx_xx_xx_xx_xx_xx  module-bluetooth-device.c       s16le 2ch 44100Hz       RUNNING
34      bluez_card.xx_xx_xx_xx_xx_xx    module-bluetooth-device.c

This way you now have your phone as a pulseaudio source. And you can record from it. This does not put your phone’s audio to the speakers at your Pi yet. You need to record from your bluetooth source and play to your default sink. You can accomplish this with arecord/aplay piped together, however you can use pulseaudio‘s loopback module which seems more elegant for this case.

To do it manually for now, first get your device’s bluetooth MAC:

$ pactl list short|grep bluez_source
34      bluez_source.xx_xx_xx_xx_xx_xx  module-bluetooth-device.c       s16le 2ch 44100Hz       RUNNING

And load loopback module like this:

$ pactl load-module module-loopback source=bluez_source.xx_xx_xx_xx_xx_xx sink=alsa_output.platform-bcm2835_AUD0.0.analog-stereo rate=44100 adjust_time=0

Now, play some music and enjoy your Pi as bluetooth speaker(s) for your phone🙂

The loopback setup is not persistent through connecting and disconnecting your phone, but these steps can be automated (hey, this is Linux). You would need a script that is run when you connect the phone over bluetooth, possibly checking the MAC of what just connected, and loading loopback module into pulseaudio with appropriate arguments.

Note that kernel log message you have seen before, when the device is connected:

Feb 12 23:01:59 raspberrypi kernel: [ 2040.500081] input: xx:xx:xx:xx:xx:xx as /devices/virtual/input/input0

This is an indication to hook the script up to udev, when an input device is connected. The device appears as /sys/devices/virtual/input/inputX directory in the system. If you grep your MAC in this directory, you will find it in the file called, oh well, name.

To summarize: when the device is connected, check /sys/devices/virtual/input/input*/name for the MAC, and load module-loopback into pi user’s pulseaudio.

OK, here’s the script:

$ sudo cat /root/bin/bluez-pulse-plugged
#!/bin/sh
ACTION=$(expr "$ACTION" : "\([a-zA-Z]\+\).*")
if [ "$ACTION" = "add" ]; then
  for f in /sys/devices/virtual/input/input*/name; do
    mac=$(cat $f|sed 's/:/_/g')
    sleep 1
    if [ ! -z "$(su - pi -c 'pactl list short|grep '$mac)" ]; then
      su - pi -c 'pactl load-module module-loopback source=bluez_source.'$mac' sink=alsa_output.platform-bcm2835_AUD0.0.analog-stereo rate=44100 adjust_time=0'
    fi
  done
fi

And here is where it gets executed:

$ sudo cat /etc/udev/rules.d/98-bluez-pulse.rules
SUBSYSTEM=="input", GROUP="input", MODE="0660"
KERNEL=="input[0-9]*", RUN+="/root/bin/bluez-pulse-plugged"

Happy listening!🙂

26 Responses to “Raspberry Pi network audio player: pulseaudio, DLNA and bluetooth A2DP – part 3: bluetooth”


  1. 1 Daniel Gillespie 12.05.2013 at 21:59

    I’ve written a better version of this that allows for full automation at boot. Please check out my guide for more info. http://www.instructables.com/id/Turn-your-Raspberry-Pi-into-a-Portable-Bluetooth-A/

    • 2 Apatsch 23.05.2013 at 22:50

      If you watch closely – mine works out of the box after any reboot

    • 3 WK 23.05.2013 at 22:55

      The version described here is ready to go after booting as well. Pairing with bluetooth device is manual (needed once for each device, trusted devices are remembered over reboot), which also means the neighbours can’t play their tunes on my pi😉

  2. 4 Glop109 14.05.2013 at 00:11

    Hello,

    These tuto are great ! A DLNA renderer on linux embedded is great🙂. But I search a output with I2S on raspberryPi or at least on a usb DAC (if i2s is not possible), with a quality output 24bits/192Kbps. Think you it’s possible ?
    Have you something to realise that ? I find nothing…

    Thanks.

  3. 5 Lanic 21.05.2013 at 22:29

    I’m having a little trouble here. By comparing both this and Daniel Gillespie’s guide i narrowed it down. My phone is recognized and configured as source, but after a few seconds this audio pipe seems to shut down and i need to run pactl load-module module-loopback source=bluez_source. etc etc line again. Any ideas why?

    • 6 Apatsch 23.05.2013 at 22:39

      Actually I did not actually read Daniel’s article at all, so with his idea YMMV. What do the logs say?

  4. 7 WK 23.05.2013 at 22:49

    Great tutorial, works flawlessly for me (single reboot needed as described…). Elegant scripting for the module-loopback!

  5. 8 Billy 01.08.2013 at 12:36

    Thanks for the great tutorial.
    I come to a problem. I followed these steps. After I connected the phone with raspi, on the phone side: it says: Connected to media audio; but on the raspi side, there is no bluez_source with the command “pactl list source”. I can only get “alsa_output.XXX.monitor”.
    Can anyone help me?

    • 9 Apatsch 05.08.2013 at 01:02

      Do you have pulseaudio-module-bluetooth installed? Did you try rebooting? What do your logs say?

  6. 10 Texy 14.10.2013 at 08:40

    Hi,
    thankyou for the tutorial. I have paring and audio streaming via bluetooth working fine on my system. What I,d like to do is get the song track, artist, etc information into python. Is there any easy way to do this? Which application uses it, pulseaudio, bluez, or ?
    Texy

  7. 11 fecub 18.01.2014 at 17:17

    Reblogged this on fecub Blog.

  8. 12 John Nevill 31.01.2014 at 05:52

    For the life of me I can’t get past the following error:

    [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method “GetProperties” with signature “” on interface “org.bluez.HandsfreeGateway” doesn’t exist

    Using your bash script I can get audio playing, but it immediately hits the error then:

    [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

    Finally unregistering endpoints /mediaendpoints/A2DPSource and A2DPSink and the music stops.

    You say you merely rebooted, but that isn’t doing the trick here. Any ideas?

    • 13 Apatsch 04.02.2014 at 23:57

      Hi, just a quick thought – do you have dbus daemon starting at boot via the rc script?

      • 14 John Nevill 05.02.2014 at 21:11

        Yep. dbus is running:

        pi@PiFM ~ $ ps -ef | grep dbus
        104 2275 1 0 Feb01 ? 00:00:01 /usr/bin/dbus-daemon –system

      • 15 Apatsch 05.02.2014 at 22:44

        A relevant syslog snippet wouldn’t hurt🙂

        I am guessing the Pi might be just dropping the BT dongle, or the dongle might be causing issues. Normally I connect the phone, and then start the playback, and things work. Maybe first thing we should do here is to check if a silent BT connection is sustained and doesn’t die, so we can eliminate all the BT magic involved. Start without using the script registering the device with pulseaudio, and try to work from here. Then check the ‘sleep 1’ line, and increase the amount, depending on what your dongle requires. But then again – logs may be helpful🙂

  9. 16 John Nevill 05.02.2014 at 23:58

    I shut off the /root/bin/bluez-pulse-plugged script that was excuted from the /etc/udev/rules.d/98* file and ran each part of the script manually, monitoring the syslog in a seperate screen. Unfortunately I had the same errors and didn’t get any more information from stdout. Console output is below. I’ll be happy to tinker if you have any ideas.

    root@PiFM:~/bin# cat /sys/devices/virtual/input/input8/name
    AC:22:0B:5D:A1:14

    root@PiFM:~/bin# su – pi -c ‘pactl list short|grep AC_22_0B_5D_A1_14’
    5 module-bluetooth-device address=”AC:22:0B:5D:A1:14″ path=”/org/bluez/3189/hci0/dev_AC_22_0B_5D_A1_14″ profile=”a2dp_source” auto_connect=no
    0 bluez_source.AC_22_0B_5D_A1_14 module-bluetooth-device.c s16le 2ch 44100Hz IDLE
    0 bluez_card.AC_22_0B_5D_A1_14 module-bluetooth-device.c

    root@PiFM:~/bin# su – pi -c ‘pactl load-module module-loopback source=bluez_source.AC_22_0B_5D_A1_14 sink=alsa_output.platform-bcm2835_AUD0.0.analog-stereo rate=44100 adjust_time=0’
    Failure: Module initialization failed

    root@PiFM:~/bin# tail -20 /var/log/syslog
    Feb 5 16:10:15 PiFM kernel: [ 246.287000] input: AC:22:0B:5D:A1:14 as /devices/virtual/input/input1
    Feb 5 16:11:17 PiFM bluetoothd[2248]: Endpoint registered: sender=:1.17 path=/MediaEndpoint/HFPAG
    Feb 5 16:11:17 PiFM bluetoothd[2248]: Endpoint registered: sender=:1.17 path=/MediaEndpoint/HFPHS
    Feb 5 16:11:17 PiFM bluetoothd[2248]: Endpoint registered: sender=:1.17 path=/MediaEndpoint/A2DPSource
    Feb 5 16:11:17 PiFM bluetoothd[2248]: Endpoint registered: sender=:1.17 path=/MediaEndpoint/A2DPSink
    Feb 5 16:11:17 PiFM pulseaudio[2626]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method “GetProperties” with signature “” on interface “org.bluez.HandsfreeGateway” doesn’t exist
    Feb 5 16:11:18 PiFM pulseaudio[2626]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    Feb 5 16:11:18 PiFM pulseaudio[2626]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    Feb 5 16:11:38 PiFM bluetoothd[2248]: Endpoint unregistered: sender=:1.17 path=/MediaEndpoint/HFPAG
    Feb 5 16:11:38 PiFM bluetoothd[2248]: Endpoint unregistered: sender=:1.17 path=/MediaEndpoint/HFPHS
    Feb 5 16:11:38 PiFM bluetoothd[2248]: Endpoint unregistered: sender=:1.17 path=/MediaEndpoint/A2DPSource
    Feb 5 16:11:38 PiFM bluetoothd[2248]: Endpoint unregistered: sender=:1.17 path=/MediaEndpoint/A2DPSink

    pi@PiFM /etc/udev/rules.d $ apt-cache policy bluez pulseaudio-module-bluetooth python-gobject python-gobject-2 | grep Installed -B 1
    bluez:
    Installed: 4.99-2

    pulseaudio-module-bluetooth:
    Installed: 2.0-6.1

    python-gobject:
    Installed: 3.2.2-2

    python-gobject-2:
    Installed: 2.28.6-10

    pi@PiFM /etc/udev/rules.d $ uname -r
    3.10.28+

    • 17 Apatsch 06.02.2014 at 00:49

      This one:
      root@PiFM:~/bin# su - pi -c 'pactl load-module module-loopback source=bluez_source.AC_22_0B_5D_A1_14 sink=alsa_output.platform-bcm2835_AUD0.0.analog-stereo rate=44100 adjust_time=0'
      Failure: Module initialization failed

      For some reason this failed. Try running pulseaudio in the foreground with -vvv. I also wonder if the source (recording dev) from bluez is actually working. Try recording from it with parecord. This also brings me to what your lsusb says (if the dongle is actually capable of all this). And, did you let things settle with a “sleep” as the script does?

      • 18 John Nevill 06.02.2014 at 02:10

        I tried parecord and piped it to aplay:

        ———————————————————————————-
        parecord -r -d bluez_source.38_0A_94_A9_12_4C –rate=8000 –channels=1 | aplay -r 8000 -c 1 -f S16_le
        ———————————————————————————-

        This worked fine and the audio didn’t stop until I either paused the music on my phone or killed the arecord process. Progress! I kicked up the rate to 44100 and channels to 2 to match the source and it played beautifully. Syslog showed the same errors (below), but parecord kept on doing it’s thing like a trooper.
        ———————————————————————————-
        Feb 5 18:19:11 PiFM bluetoothd[2227]: Endpoint registered: sender=:1.23 path=/MediaEndpoint/HFPAG
        Feb 5 18:19:11 PiFM bluetoothd[2227]: Endpoint registered: sender=:1.23 path=/MediaEndpoint/HFPHS
        Feb 5 18:19:11 PiFM bluetoothd[2227]: Endpoint registered: sender=:1.23 path=/MediaEndpoint/A2DPSource
        Feb 5 18:19:11 PiFM bluetoothd[2227]: Endpoint registered: sender=:1.23 path=/MediaEndpoint/A2DPSink
        Feb 5 18:19:11 PiFM pulseaudio[2672]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method “GetProperties” with signature “” on interface “org.bluez.HandsfreeGateway” doesn’t exist
        Feb 5 18:19:11 PiFM pulseaudio[2672]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method “GetProperties” with signature “” on interface “org.bluez.HandsfreeGateway” doesn’t exist
        Feb 5 18:19:11 PiFM pulseaudio[2672]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method “GetProperties” with signature “” on interface “org.bluez.HandsfreeGateway” doesn’t exist
        Feb 5 18:19:11 PiFM pulseaudio[2672]: [pulseaudio] source.c: Default and alternate sample rates are the same.
        Feb 5 18:19:12 PiFM pulseaudio[2672]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
        Feb 5 18:19:12 PiFM pulseaudio[2672]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
        Feb 5 18:19:12 PiFM pulseaudio[2680]: [pulseaudio] pid.c: Daemon already running.
        Feb 5 18:20:43 PiFM bluetoothd[2227]: Endpoint unregistered: sender=:1.23 path=/MediaEndpoint/HFPAG
        Feb 5 18:20:43 PiFM bluetoothd[2227]: Endpoint unregistered: sender=:1.23 path=/MediaEndpoint/HFPHS
        Feb 5 18:20:43 PiFM bluetoothd[2227]: Endpoint unregistered: sender=:1.23 path=/MediaEndpoint/A2DPSource
        Feb 5 18:20:43 PiFM bluetoothd[2227]: Endpoint unregistered: sender=:1.23 path=/MediaEndpoint/A2DPSink
        ———————————————————————————

      • 19 John Nevill 06.02.2014 at 02:17

        I just tried running pactl without using su – pi -c before the command while logged in as pi (not root). The output is different. Instead of “Failure: Module initialization failed” it just says “22”…

        pi@PiFM /etc/init.d $ ps -ef | grep pulse | grep -v grep
        pi@PiFM /etc/init.d $ pactl load-module module-loopback source=bluez_source.38_0A_94_A9_12_4C sink=alsa_output.platform-bcm2835_AUD0.0.analog-stereo rate=44100 adjust_time=0
        22

        pi@PiFM /etc/init.d $ tail -14 /var/log/syslog
        Feb 5 19:13:39 PiFM bluetoothd[2227]: Endpoint registered: sender=:1.82 path=/MediaEndpoint/HFPAG
        Feb 5 19:13:39 PiFM bluetoothd[2227]: Endpoint registered: sender=:1.82 path=/MediaEndpoint/HFPHS
        Feb 5 19:13:39 PiFM bluetoothd[2227]: Endpoint registered: sender=:1.82 path=/MediaEndpoint/A2DPSource
        Feb 5 19:13:39 PiFM bluetoothd[2227]: Endpoint registered: sender=:1.82 path=/MediaEndpoint/A2DPSink
        Feb 5 19:13:39 PiFM pulseaudio[3022]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method “GetProperties” with signature “” on interface “org.bluez.HandsfreeGateway” doesn’t exist
        Feb 5 19:13:39 PiFM pulseaudio[3022]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method “GetProperties” with signature “” on interface “org.bluez.HandsfreeGateway” doesn’t exist
        Feb 5 19:13:39 PiFM pulseaudio[3022]: [pulseaudio] bluetooth-util.c: org.bluez.HandsfreeGateway.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method “GetProperties” with signature “” on interface “org.bluez.HandsfreeGateway” doesn’t exist
        Feb 5 19:13:39 PiFM pulseaudio[3022]: [pulseaudio] source.c: Default and alternate sample rates are the same.
        Feb 5 19:13:40 PiFM pulseaudio[3022]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
        Feb 5 19:13:40 PiFM pulseaudio[3022]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
        Feb 5 19:14:00 PiFM bluetoothd[2227]: Endpoint unregistered: sender=:1.82 path=/MediaEndpoint/HFPAG
        Feb 5 19:14:00 PiFM bluetoothd[2227]: Endpoint unregistered: sender=:1.82 path=/MediaEndpoint/HFPHS
        Feb 5 19:14:00 PiFM bluetoothd[2227]: Endpoint unregistered: sender=:1.82 path=/MediaEndpoint/A2DPSource
        Feb 5 19:14:00 PiFM bluetoothd[2227]: Endpoint unregistered: sender=:1.82 path=/MediaEndpoint/A2DPSink

      • 20 Apatsch 06.02.2014 at 02:28

        22. The answer to the universe and everything was 42, not 22. Just kidding🙂 It returned the module index, things are good.
        I spotted “Daemon already running” in your previous log output. These both got me thinking what user is your pulseaudio running with. The article assumes you have pulseaudio set-up as in part 1 – https://rootprompt.apatsch.net/2013/02/20/raspberry-pi-network-audio-player-pulseaudio-dlna-and-bluetooth-a2dp-part-1-pulseaudio/ – so you mileage may vary. In this case using (and omitting) su as needed should get you going🙂

      • 21 John Nevill 06.02.2014 at 03:41

        I would be happier if it reported “42” instead of 22…

        I ran pulseaudio with -vvv and stuck the output here: http://pastebin.com/Sf0J6szE

        I took the following steps:
        1. Started pulseaudio with -vvv
        2. After 10 seconds I connected the bluetooth device
        3. After 5 seconds or so I run the pactl command
        4. After a second or two I started playing audio on the device
        5.
        6. Profit (actually pulseaudio shut down at this point and I uploaded to pastebin)

        You’ll see the errors at line 649, 651, and 652. This is just after connecting the device. It doesn’t seem to matter if I play something or not, pulse dies either way. Here’s (http://pastebin.com/zvDfvTMa) a log without playing any audio.

        I think it just doesn’t like me. I’ll keep screwing around with it though. It will bend to my will.

  10. 22 ziga1212 22.02.2014 at 17:41

    I followed this instructions and for the first time I could actually play music from my tablet on raspberry. Then I tried connecting my iPod and it also worked, but the sound was choppy. I rebooted the system and now I can’t get music to play anymore. Tablet connects to raspberry like it did before and in pavucontrol shows Nexus 7 as input device and audiolevel is changing so sound is transmitted succesfuly. Then I input the pactl load-module loopback.. command and it outputs “24” (or some other number) as it should, but audio still doesn’t play. I tested audio jack with speaker-test and everything was working corectl. Anybody has any idea what should I do?

    • 23 satishkini 27.04.2014 at 04:50

      Hi,
      I too am facing the same problem. Did you find a fix for the problem ?

  11. 24 FS 18.07.2014 at 23:16

    I have the same problem described above, specifically after 10 seconds or so it cuts out and this is in syslog:

    Jul 18 21:11:00 raspberrypi bluetoothd[2182]: Endpoint unregistered: sender=:1.13 path=/MediaEndpoint/HFPAG
    Jul 18 21:11:00 raspberrypi bluetoothd[2182]: Endpoint unregistered: sender=:1.13 path=/MediaEndpoint/HFPHS
    Jul 18 21:11:00 raspberrypi bluetoothd[2182]: Endpoint unregistered: sender=:1.13 path=/MediaEndpoint/A2DPSource
    Jul 18 21:11:00 raspberrypi bluetoothd[2182]: Endpoint unregistered: sender=:1.13 path=/MediaEndpoint/A2DPSink

    • 25 FS 25.07.2014 at 10:22

      I found the solution to my problem, so in case anyone else has the same… the problem was that using Raspian I could get bluez working with pulseaudio for about 20 seconds but then it would cut out and the bluez source would go back to IDLE. The fix is to uncomment or add this line to /etc/pulse/daemon.conf:

      exit-idle-time = -1

      This didn’t used to be necessary but something must have changed in PulseAudio.

  12. 26 John 24.06.2015 at 19:57

    Bluetooth A2DP has become well supported and is easy to set up alsa to stream from RPI with the proper guide. I use it to stream from MPD to a bluetooth/WiFi speaker (Jongo S3) and within the rather limited range of bluetooth it works well. I also have minidlna installed and I can stream over WiFi to the speaker from bubble (and other DLNA clients) from my (xoom) android table.

    My question is do you know how to setup the RPI to stream (preferably MPD) to a WiFI speaker? Apparently as far as I can tell the Jongo (WiFi) is nothing more than a DLNA client and doesn’t appear to be proprietary. I can’t find anything on the internet that appears to deal with this subject.
    Thanks


What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Enter your email address to follow this blog and receive notifications of new posts by email.

Join 50 other followers

Marcin Gałkowski

Seasoned admin, Linux hacker, Android fan, Gentoo enthusiast. Doing digital audio on Linux when time permits. At work: IT Team Lead (+labs, +datacenters...)

Latest Tweets

BTC tip jar:

1HprotPu2zi8v8hFZBqVfcTYL7ZYVYBruo

%d bloggers like this: