247 Responses

  1. Philippe Vaille-Brunet at | | Reply

    Hello
    Sorry but I get troubles with the Bose SLIII
    here is the description :
    pacmd list-cards
    2 card(s) available.
    index: 1
    name:
    driver:
    owner module: 7
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Mono analogique Output (priority 200, available: unknown)
    output:analog-stereo: Stéréo analogique Output (priority 6000, available: unknown)
    off: Éteint (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Stéréo analogique
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#1: Monitor of bcm2835 ALSA Stéréo analogique
    ports:
    analog-output: Sortie analogique (priority 9900, latency offset 70000 usec, available: unknown)
    properties:

    index: 6
    name:
    driver:
    owner module: 32
    properties:
    device.description = “Bose SLIII”
    device.string = “08:DF:1F:4D:1E:59”
    device.api = “bluez”
    device.class = “sound”
    device.bus = “bluetooth”
    device.form_factor = “hifi”
    bluez.path = “/org/bluez/hci0/dev_08_DF_1F_4D_1E_59”
    bluez.class = “0x240428”
    bluez.alias = “Bose SLIII”
    device.icon_name = “audio-card-bluetooth”
    profiles:
    a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: yes)
    off: Éteint (priority 0, available: yes)
    active profile:
    sinks:
    bluez_sink.08_DF_1F_4D_1E_59.a2dp_sink/#4: Bose SLIII
    sources:
    bluez_sink.08_DF_1F_4D_1E_59.a2dp_sink.monitor/#6: Monitor of Bose SLIII
    ports:
    hifi-output: HiFi (priority 0, latency offset 0 usec, available: yes)
    properties:

    hifi-input: HiFi (priority 0, latency offset 0 usec, available: no)
    properties:
    only a2dp_sink gives an answer, else headset is unknown
    the main difference is to priority and latency which are quite different from the alsa jack output
    when reading of the .ogg file is set , there is reading but any sound out from the bose
    I set the hcitool but I don’t know what ’s for.

    When I tried bluez in terminal mode, I got a message : frame isn’t transmitted approximatively
    I noted than the pulseaudio (pavucontrol ) never gives information about the bose in output devices
    Any suggestion will be readen attentivily.
    Thanks a lot by Philippe

  2. Larry at | | Reply

    Youness,
    Tried your instructions but cannot get set profile and sink. Errors on each.
    I have a headphone unit working well on a2dp but have been unable to get speaker working.
    When trying the speaker it pairs and connects but there is no card listed for the unit.
    As a sidenote….i tried a completely clean system (using stretch) and couldn’t get either unit to output sound. Headphones pair and connect and show as card1 but have been unable to activate profile. Speaker pairs and connects but do not even show as card. I have been reading all your efforts and will continue to monitor your site. Thanks for all your hard work.
    Larry

  3. Larry at | | Reply

    Hi Youness, didn’t expect such a quick reply…..thanks.
    Buth units work well with android and ios hardware.
    I did turn off bluesalsa and noticed that the profile was turned off in pavuaudio so i rebooted and turned the profile on.
    I will be busy with other things today but will try to capture some info when i get a chance.
    Seems like all works well in your guide until I check cards as explained above. And seems odd that i can get a card for the headphones and can connect bit cannot get audio to output. Both units appear to suppory a2dp and hfp.

  4. Jan at | | Reply

    Hey Guys,

    I thought I’d highjack the comment section of your post, Youness, and ask for help in a similar setup I’m trying to get working: In my case I have an USB audio interface with in- and outputs connected to a Raspberry Pi Zero. I want the Pi to connect to another device (pc, ipad…) registering as a bluetooth headset (using hsp). So far following a mixture of your tutorial and this link (https://didier.io/post/raspberrypi-stream-sound-over-bluetooth) I managed to configure the pi as a bluetooth speaker. But I can not get it to send the microphone input of the audio-interface over bluetooth… Any ideas? I tried different values for the Class parameter in /etc/bluetooth/main.conf .. So far without success.

    Any help or ideas would be greatly appreciated!
    Jan

    1. Najam Munawar at | | Reply

      hello jan were you able to accomplish using pi zero as headset for other devices?
      Please let me know as i am working on something similar

  5. Philippe Vaille-Brunet at | | Reply

    Hi to everyone
    A lot of responses
    some progress today
    1 to youness
    the bose SLIII is only made for playing music
    and I want to run it in my home without connection to the Pi3 except by bluetooth
    2 to Larry and youness
    this afternoon, after some trials with terminal and gui nothing get
    but just now afer restarting the Pi3
    I start the Bose
    I click on bluetooth : make discoverable, add device and wait for bose, paired it
    and
    suprise : in a terminal I just killer the bluealsa
    and in pulseaudio gui I got the Bose in output device
    in Bluemindo I started playing a music
    go back to every sourdine button in audio, pulseaudio output and playing
    now it’s running nearly well.

    Is the main progress would be stop the bluealsa service in console?
    I’ll try later, for instance I listen with pleasure.
    Thanks a lot.
    Philippe

  6. Philippe Vaille-Brunet at | | Reply

    Sorry youness
    but 45mn after the starting , I lost the stream on the bose
    I try to restart but nothing for instance.
    A new pi restarting give me a bose instance
    how :
    1 turn on the bluetooth by clicking on its icon
    2 click on the audio speaker to connect the bose if exists; if not add …
    3 the bose answers by a bip
    4 open a terminal and kill the bluealsa service
    5 go to bluetooth, verify bose is connected
    6 then start the music player ( bluemindo for me )
    7 choice the file to play
    seriously it’s fine
    The question : it’s little complex
    Philippe

  7. Connor at | | Reply

    Hello Youness,

    Thank you! This has been frustrating me for the last two weeks!

    I’m so close, yet so far! I’m getting the error you mention in the article:
    Failed to set card profile to ‘headset_head_unit’.

    I’ve restarted and re-synced the bluetooth device: (https://www.amazon.co.uk/gp/product/B076HRH34T/ref=oh_aui_detailpage_o03_s00?ie=UTF8&th=1)

    But, I still seem to get that error every time. I’ve tried a couple of things I found digging through some old forum posts, but nothing seems to fix the problem.

    I’m not sure what to try next, I was hoping you may know? Here’s the pacmd card listing: https://gist.github.com/anonymous/6fd573116eb37fcf1a917301ebfe8725

    The profile headset_head_unit does appear in the listed profiles, but I can’t set it as the active profile for some reason, I can set it to a2dp and off however.

    Could it possibly be because the listed protocol is (HSP/HFP) as opposed to being solely HSP?

    Thanks for any help and for all the effort you’ve put into solving this problem so far!

    1. Connor at | | Reply

      So, in the pacmd card listing it denotes that both a2dp_sink and headset_head_unit are both ‘unknown’ to be available:

      headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: unknown)
      a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown)

      However, I am able to switch the card profile and default-sink to a2dp_sink and play the audio file. But again when I try to switch the profile to headset_head_unit it fails with the above error.

      1. Connor at | | Reply

        Oops! We seem to have posted replies simultaneously.

        So, I just tried connecting it to my computer and managed to both play and record audio when it’s connected. I’ve also just tried this on my phone and managed to do the same, both without requiring a passcode or any authentication step. The device simply connects.

        What I’ve tried in terms of removing the device is to open bluetoothctl and remove the device from there. Is this what you’re referring to?

  8. Philippe Vaille-Brunet at | | Reply

    Hi youness
    the problem continues with my bose
    this evening it’s impossible to connect or remove the bose. I get error message about tre gdbus
    May I send you a scrennshot about errors
    The messages texts are :
    remove device : removal failed – GDBus.Error:org.bluez.Error.NotReady: Ressource Not Ready
    The other one:
    Connecting Audio Device: Failed to connect to device-
    GDBus.Error:org.bluez.Error.NotReady: Ressource Not Ready. Try to connect again..
    But I tried for one and half hour.
    Is it a bug?

  9. Philippe Vaille-Brunet at | | Reply

    Hi youness
    me again, sorry. But I’ld to understand how it’s work
    My last trial :
    I made the bluetooth script as above, I got an error about the LSB tags when I run the update.rc command
    I start again the Pi3 and connection to bose started immediatly
    I get rid of bluemindo and install aqualung
    I run aqualung on a Music directory
    But the pavucontrol doesn’t see the connected bose, so any music out in my ears
    if I use the wire between the jack connector’pi and the bose’jack, I got audible music.
    Do you know how we could get the bose-bluetooth line in the output-pavucontrol as soon as we have connected bose in the audio icon and in the bluetooth icon on the taskbar?
    Sorry for such disturbing elements
    Thanks a lot for any response.
    Philippe

  10. Eirik at | | Reply

    Thanks for this article. I actually had this working “right out of the box”, which makes the problems even more annoying. I had jessie running, and the only thing I did was to bluetoothctl pair and connect my Bluetooth speaker, and it connected, and STAYED connected. I could play mp3s of the command line, and use text-to-speech which was part of the project.

    Then suddenly, while testing, the audio stuck and repeated (broken record, extremely fast), and I had to turn off the Bluetooth speaker. Since then, I have not been able to pair again using the default alsa. I since upraded to stretch, it only worked using pulseaudio, but sound is very choppy. It sure would have been nice to have a simple and working A2DP and HSP.

  11. Philippe Vaille-Brunet at | | Reply

    Hi youness
    Thanks a lot for all your answers
    The bose is now running, how?
    using what you say by console.
    I uninstall bluealsa… may be a bad idea for another app?
    If I try to resume
    switch on the bose
    start bluetoothctl and the steps power on agent on default-agent : we wait for yes
    scan on sees the bose in some seconds, pair, trust and connect even if we havn’t answers «on» with pair and trust, connect has to get connected in any case.
    open pavucontrol
    in parallel : pacmd list-cards in which we wait the bose recognition
    and the 2 other commands
    pavu reacts to the pacmd commands
    If we start pulseaudio in console, the streaming flow is bad because the console prints out the levels of the streaming and creates interruptions.
    Running good for 3 hours, fine! The dream!
    For me, an improvement in order to click on something once would be better for start recognition and real connection of the bose. I can wait now I learned the console steps.
    Bye! Pleasure to meet you!
    Philippe

  12. Fabrizio at | | Reply

    Dear Youness, first of all i want to express my gratitude for sharing your knowledge/time with us.
    i have read all your project since the begin and applied to my situation.
    every tink whent ok and i was able to pair and connect the device in both protocol (hsp a2dp), i succeded to record and play a recorded audio…great…
    i would like to automate the connection after reboot , and i saw some indication that you suggested and i’ll try to applicate.
    what is not very clear to me is what in the procedure is permanent and what must be automated at reboot.
    for example, this command should be repeated at every boot?: sudo hcitool cmd 0x3F 0x01C 0x01 0x02 0x00 0x01 0x01

    i try to explane my project that is now in the first step and maybe i’ll get some suggestion.
    we are a group of motorcycle bikers, we ride in goup and we all have bluetooth devices in the helmets connected to the smartphone and some of us are also connected in intercom from bike to bike.
    the range of the bluetooth in certain condition is not enough so we want to use rtx radios (uhf/pmr).
    The project is to connect a common two way radio with the the bluetooth installed in the helmet.
    the idea is to connect via bluetooth a raspberry to the interphone (done, to be automated) and than to physically connect the raspberry (probably wit an extra audio dongle) to the mic/spk connector of the radio.
    when i am talking into the Helmet’s microphone, the audio should exit from a connector and enter in the mic connector of the radio.
    what the radio receive a signal, the audio getting out from the spk connector should enter in the raspberry and streamed into the helmet.

    Any suggestion? ……Tks in advance

  13. Randy T at | | Reply

    Minor nit
    For the install pulse audio commands, this looks incorrect:
    sudo apt-get install pulseaudio pulseaudio-module-bluetoot

    I think it should be bluetooth at the end, instead of bluetoot

    Also, I would disable the internal bluetooth interface on the pi3
    cd /boot
    sudo nano config.txt

    Add to config.txt:
    #disable the internal bluetooth
    dtoverlay=pi3-disable-bt

    You may also need to do this (I haven’t tried it yet)
    sudo systemctl disable hciuart.service

    I just bought an asus bluetooth module, and plan to try your instructions to install it, thanks.

  14. JK at | | Reply

    Hello,

    Yes, I have the same issue with distorted audio.
    I believe the problem may be caused by a sample format mismatch.
    I can hear it when I loopback the audio.

    What exactly is the following command in the final solution supposed to do?
    “sudo hcitool cmd 0x3F 0x01C 0x01 0x02 0x00 0x01 0x01”

    Is there a byte-for-byte breakdown?
    Is the sample format encoded in there somewhere?

    -Cheers

    JK

  15. Theodore Stavropoulos at | | Reply

    Will this work with an external bluetooth adapter such as

    http://www.lemosint.com/bluetooth/bluetooth_serial_adapter_details.php?itemID=612

    Im thinking about putting this in the office and hooking up my Dre PowerBeat3’s to it and running google home on the Pi. This way ive got Google home hooked up playing audio through my headphones and listening to commands from me on the attached mic

  16. SouSouleBarbu at | | Reply

    Hi Youness,

    I’m facing a weird situation: I have followed all the steps and I didn’t get any error. I got the sound when I types paplay /tmp/h2g2;ogg on A2DP, but no sound on HSP.

    I tried to remove, reconnect, reboot… multiple time, but I doesn’t change a thing…
    That’s really weird because I didn’t got any error…

    Config, RP3 with doss soundbox.

    Thanks a lot!

  17. Phil171 at | | Reply

    Hi,
    Same problem as SouSouleBarbu. I followed all the tutorial, can hear h2G2.ogg, but cannot hear an MP4.
    When I want to change in Blueman-Manager the audio profile to A2DP Sink, it return “Failed to change profile to a2dp_sink”.
    But even on Headset Head Unit (HSP/HPF), on my Philips SHB7000 head set, no sound.
    Best Regards from France,
    Philippe

  18. TheodoreStav at | | Reply

    Hey Youness,

    Ive given it multiple trys but keep getting the “failed to set card profile to ‘headset_head_unit’ ive removed the device and rebooted i can hear audio but cant record.. Any other suggestions ? these are powerbeat 3’s im trying with a pi 3

    index: 1
    name:
    driver:
    owner module: 24
    properties:
    device.description = “Theobeats”
    device.string = “2C:33:61:D8:BC:B4”
    device.api = “bluez”
    device.class = “sound”
    device.bus = “bluetooth”
    device.form_factor = “headphone”
    bluez.path = “/org/bluez/hci0/dev_2C_33_61_D8_BC_B4”
    bluez.class = “0x240418”
    bluez.alias = “Theobeats³”
    device.icon_name = “audio-headphones-bluetooth”
    profiles:
    a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown)
    headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: no)
    off: Off (priority 0, available: yes)
    active profile:
    ports:
    headphone-output: Headphone (priority 0, latency offset 0 usec, available: unknown)
    properties:

    headphone-input: Bluetooth Input (priority 0, latency offset 0 usec, available: no)
    properties:

  19. TheodoreStav at | | Reply

    more to add to my post above…

    pi@raspberrypi:~ $ systemctl status bluetooth
    ● bluetooth.service – Bluetooth service
    Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2018-03-10 23:13:26 UTC; 28min ago
    Docs: man:bluetoothd(8)
    Main PID: 524 (bluetoothd)
    Status: “Running”
    CGroup: /system.slice/bluetooth.service
    └─524 /usr/lib/bluetooth/bluetoothd

    Mar 10 23:13:26 raspberrypi bluetoothd[524]: Endpoint registered: sender=:1.9 path=/A2DP/SBC/Source/1
    Mar 10 23:13:26 raspberrypi bluetoothd[524]: Endpoint registered: sender=:1.9 path=/A2DP/SBC/Sink/1
    Mar 10 23:13:32 raspberrypi bluetoothd[524]: Endpoint registered: sender=:1.17 path=/MediaEndpoint/A2DPSource
    Mar 10 23:13:32 raspberrypi bluetoothd[524]: Endpoint registered: sender=:1.17 path=/MediaEndpoint/A2DPSink
    Mar 10 23:13:32 raspberrypi bluetoothd[524]: RFCOMM server failed for Headset Voice gateway: rfcomm_bind: Address already in use (98)
    Mar 10 23:13:38 raspberrypi bluetoothd[524]: /org/bluez/hci0/dev_2C_33_61_D8_BC_B4/fd0: fd(29) ready
    Mar 10 23:17:04 raspberrypi bluetoothd[524]: Unable to get io data for Hands-Free Voice gateway: getpeername: Transport endpoint is not connected (107)
    Mar 10 23:17:33 raspberrypi bluetoothd[524]: /org/bluez/hci0/dev_2C_33_61_D8_BC_B4/fd1: fd(29) ready
    Mar 10 23:26:24 raspberrypi bluetoothd[524]: Endpoint unregistered: sender=:1.9 path=/A2DP/SBC/Source/1
    Mar 10 23:26:24 raspberrypi bluetoothd[524]: Endpoint unregistered: sender=:1.9 path=/A2DP/SBC/Sink/1

  20. simalto at | | Reply

    I am using raspberry pi zero w. with PA 10.0 and Bluez 5.43.
    I have manage to use my headset in A2DP mode without problem.
    But when I change to HSP profile no sound heard or mic record.
    by using the hcitool command(sudo hcitool cmd 0x3F 0x01C 0x01 0x02 0x00 0x01 0x01),
    I was able to hear sound and record.
    But my problem is that the sound is very bad and slow like motion.

    I am suspecting it has something to do with the pi zero w chip(BCM2835)
    according to this link:https://www.raspberrypi.org/magpi/pi-zero-w/

    can anyone help me with relevant hcitool command for this chip?
    Thanks in advance!

  21. Bastian at | | Reply

    Thank you for the real good work. I only required the A2D2P-support and due to your post it works the first time without sticking around for me. Using Raspberry pi zero w with Riva Turbo X on Raspbian Stretch. I issued the sound beeing slow motion alike, too. Hope to fix it in this weekend.

  22. alex at | | Reply

    I still don’t get sound on Bluetooth speaker/headset. I do get connected.
    After giving command (one of the first steps described): ‘sudo killall bluealsa’, I get ‘Invalid Command’
    So can not follow your Tutorial any further..
    Also ‘pacmd list-cards’ or further ‘pacmd’ are not recognized and I get ‘Invalid Command’

    http://youness.net/raspberry-pi/how-to-connect-bluetooth-headset-or-speaker-to-raspberry-pi-3

  23. alex at | | Reply

    Hi,
    Got a bit further, but now get (where: ’90:1F:F1:3C:AF:41′ is my Bluetooth speaker ‘S10’):
    pi@raspberrypi:~ $ pa is too loncmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.

    ===
    pi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)pi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    anapi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd pi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    anapi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.log-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.pi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    anapi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd pi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    anapi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:pi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    anapi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmpi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    anapi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.log-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.pi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    anapi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmpi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    anapi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    alsa.driver_name = “snd_bcm2835”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.log-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.d set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.log-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.d set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.log-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card fopi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card fpi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.ound by this name or index.pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.und by this name or index.
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberpi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.rypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.log-output: Analog Output (priority 9900, latency offsepi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card foupi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.nd by this name or index.pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.t 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.log-output: Analog Output (priority 9900, latency offsepi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.t 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card foupi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.nd by this name or index.set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.log-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm28pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.35 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-card-profile bluez_card.90:1F:F1:3C:AF:41 a2dp_sink
    No card found by this name or index.

  24. Salim at | | Reply

    Hi Youness,

    any updates about this ? The profile Headset Head Unit is always not available for me, no matter how many time i reset.

    I did a xargs grep on the whole system and this line (headset_head_unit) is referred in two files :

    Binary file /usr/lib/pulse-10.0/modules/libbluez5-util.so matches
    Binary file /usr/lib/pulse-10.0/modules/module-bluetooth-policy.so matches

    Hope this helps.

    I have been looking myself in the file but nothing there that i modified impacted the behavior of pulseaudio

    Salim

  25. Salim at | | Reply

    Changes at a glance

    Support for newer AirPlay hardware
    USB and bluetooth devices preferred over internal sound cards
    The default sink and source configuration is remembered better
    Bluetooth HSP headset role implemented
    Bluetooth HFP audio gateway role implemented (requires oFono)
    Bluetooth HSP audio gateway and HFP hands-free unit roles can be enabled simultaneously
    Upmixing can now be disabled without bad side effects
    Avoid having unavailable sinks or sources as the default
    Option to avoid resampling more often
    Option to automatically switch bluetooth profile to HSP more often
    Better latency regulation in module-loopback
    Changed module argument names in module-ladspa-sink and module-virtual-surround-sink
    Fixed input device handling on Windows
    Improved bluetooth MTU configuration (warning! this causes some hardware to not work any more, see the details below for how to fix it)
    GNU Hurd support
    Applications can request LADSPA or virtual surround filtering for their streams
    Support for 32-bit applications on 64-bit systems in padsp

    https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/11.0/

    Those are for 11.0, 11.1 is out atm.

    Please let me know if you need more help, ill keep probing here.

  26. Salim at | | Reply

    I managed to update to 11.1 Pulseaudio, i will let you know tonight any changes.

  27. Salim at | | Reply

    Youness,

    Sorry to bother you that much. If the bluetooth firmware is the problem, here is https://github.com/seemoo-lab/nexmon

    If you know someone that can modify the firmware and inject it using that tool would be great ( if of course the firmware is in fault)

  28. Nirav Patel at | | Reply

    Hi Yonuness,

    I have tried with your steps many times with out any success. i am trying to connect MI bluetooth speaker (http://www.mi.com/in/mi-bluetooth-speaker-basic2-white/) using HSP. not able to set headset_head_unit profile. any kind of help/suggestions will be appreciated.

    Thanks

  29. Filozof71 at | | Reply

    Hello. I performed this configuration on my Raspberry Pi Zero W (with newest updates and upgrades) with two headsets and the result is the same. The record voice is somehow overdriven and digitized – just unrecognizable. So for the one hand it works for me – for the other – no.

    1. Helmut at | | Reply

      This has been my experience. I was successful in configuring the RPI3 with a UEBOOM 2 and a MPOW headset and microphone. Unfortunately, the recorded voice is very bad (overdriven and digitized is a good description). Sadly, I probably need to go back to the Bluetooth dongle approach. I am running Wifi and bluetooth at the same time. Another poster mentioned the RPI3 Model B+ may have better performance.

  30. John Zawodniak at | | Reply

    Excellent instructions.
    They helped me solve my problem were the bluetooth adapter was not showing up in the card list.

    one recommendation.
    these instructions could be a little clearer. When killing the bluealsa we need to use the “exit” command to exit the shell or move to another terminal window. If exiting the shell we need to re-enter with “bluetoothctl” and exit again prior to the pacmd list-cards cmd… It lost me for a few minutes.

    ……
    Start the scan:
    scan on

    After some seconds, you will see the headset name and MAC address (xx:xx:xx:xx:xx:xx)
    While scanning, we will kill Bluealsa, and start PulseAudio:
    sudo killall bluealsa
    pulseaudio –start

    Go back to Bluetoothctl: Pair, trust and connect your device:
    pair xx:xx:xx:xx:xx:xx

    Again, overall excellent work.
    John

  31. Xanderphillips at | | Reply

    Thinking this could be a good way for me to setup a RPI as an outdoor solar powered bluetooth microphone to pick up nature sounds and then have an inside bluetooth speaker setup to listen to the outdoors.

  32. Chuck Lidderdale at | | Reply

    Hey – 1st, thanks – it works.
    2d – I took the steps [ ie. bluetoothctl <<< "pair C9:5A:0…" etc killall …] and run as a script when I login. Problem is if my speaker is connected, it Disconnects. And I have to run it a second time. [ ya poor me ] but it's a pita. Is there a command where I can say: if ( BT == connected ) don't run script;

    3d – thanks again.
    c

  33. KBM at | | Reply

    It worked!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks!!!!!!!!!!

    1. rutuja at | | Reply

      How did you get it to work?? I followed the entire tutorial, rebooted several times with no luck.

  34. Debarghya at | | Reply

    pacmd list-cards

    For HSP Support

    sudo hcitool cmd 0x3F 0x01C 0x01 0x02 0x00 0x01 0x01

    Next use this command instead of the one mentioned in the tutorial (pacmd set-card-profile bluez_card.xx_xx_xx_xx_xx_xx headset_head_unit)

    pacmd set-card-profile 1 headset_head_unit

    Card #1
    Name: bluez_card.1C_52_16_15_EF_14
    Driver: module-bluez5-device.c
    Owner Module: 24

  35. Rutuja at | | Reply

    Hello youness,
    I followed your tutorial and tried rebooting repeatedly, i still get the error ,”failed to change profile to headset_head_unit.
    please suggest a solution.
    I am working with the latest version of raspbian stretch and pi 3

  36. Skunk_Mcfunk at | | Reply

    so thankful for all your work and time man! I just wanna know is there a way to set the audio output to the default jack while keeping the audio input through my bluetooth headset?

  37. Dominique at | | Reply

    Hi Youness,

    thanks for your article, it’s a great work.

    My headset is – almost – working. Your opinion would be great :

    – all your commands are working (few of them with a reboot like you said). The A2DP part is working, I have sound in my speakers (Suaoki T9S Bluetooth Motorcycle).
    – when I try the commands for enabling HSP (for microphone if I understand), I haven’t any sound and the command “arecord” use Alsa [Connected to device alsa_output.platform-soc_audio.analog-stereo.monitor (index: 0, suspended: no)]. If i specify a device (with -d) I have a “Stream error: No such entity”.

    Have you and idea to have both play & record with my headset ?

    Thanks in advance 🙂

  38. Dominique at | | Reply

    Yes,

    I’ve re-re-read all the comments and I forget to precise that I use a USB-dongle. So it should be easier ? 😀

  39. Dominique at | | Reply

    .. and the command for record is parecord not arecord of course, typo 🙂

  40. Dominique at | | Reply

    is a driver needed ? If I have sound with a2dp, it would work for everything no ? I’m lost 🙂

  41. Dominique at | | Reply

    I already read it and i have prayed for not have to do this 😀

    The dongle is recognized on a fresh Raspbian Stretch (with GUI) and connect well, just for sound, not for mic :/

    I have no idea.

  42. Dominique at | | Reply

    “Integral”. Big thanks

  43. Venu at | | Reply

    I followed all your instructions and able to play and record from bluetooth speaker.
    Now I trying “OK, Google” as mentioned in https://www.raspberrypi.org/forums/viewtopic.php?t=204865.

    Now google’s python script is not recognizing the microphone, script is throwing error mic_failure_detector.cc.

    Need your help in resolving this.

    (env) pi@raspberrypiVenu:~/AIY-projects-python $ python3 src/main.py
    /home/pi/AIY-projects-python/src/aiy/_drivers/_led.py:51: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
    GPIO.setup(channel, GPIO.OUT)
    Say “OK, Google” then speak, or press Ctrl+C to quit…
    [3716:3744:ERROR:mic_failure_detector.cc(140)] [assistant] Channel 1 has failed. Powers -inf and -inf

  44. Fish at | | Reply

    Youness thanks for the tutorial!

    Everything was successful and I played the h2g2.ogg successfully. My problem is after I reboot my retropie I cannot get the headphones to connect automatically. Is there a way to connect to registered devices? All I know of is the GUI, but when I select display registered devices or connect to registered devices I get a “Unit sixad.service could not be found” error.

    I don’t know if it matters but this is a compute module so I’m using a usb bluetooth dongle.

  45. ade at | | Reply

    Hello,

    pulse audio doesn’t find the bluetooth speaker I am connected to, any suggestion?:

    [SPK312]# info E8:07:BF:0F:DA:F5
    Device E8:07:BF:0F:DA:F5
    Name: SPK312
    Alias: SPK312
    Class: 0x240404
    Icon: audio-card
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
    UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
    [SPK312]# exit
    [DEL] Controller B8:27:EB:FD:B3:37 raspberrypi [default]
    pi@raspberrypi:~ $ pacmd list-cards
    1 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/bcm2835_alsa/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#0: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $

  46. […] Source: How To Connect Bluetooth Headset Or Speaker To Raspberry Pi 3 […]

  47. lee at | | Reply

    hi ive tryed following your tutorial but its not working the headset is connected and showing up but i cant get any audio output or microphone input.

    pi@raspberrypi:~ $ pacmd list-cards
    2 card(s) available.
    index: 1
    name:
    driver:
    owner module: 7
    properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/bcm2835_alsa/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Analog Mono Output (priority 200, available: unknown)
    output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
    off: Off (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Analog Stereo
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#1: Monitor of bcm2835 ALSA Analog Stereo
    ports:
    analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    index: 3
    name:
    driver:
    owner module: 27
    properties:
    device.description = “Gioteck LP-1”
    device.string = “00:25:DB:15:AB:26”
    device.api = “bluez”
    device.class = “sound”
    device.bus = “bluetooth”
    device.form_factor = “headset”
    bluez.path = “/org/bluez/hci0/dev_00_25_DB_15_AB_26”
    bluez.class = “0x200404”
    bluez.alias = “Gioteck LP-1”
    device.icon_name = “audio-headset-bluetooth”
    device.intended_roles = “phone”
    profiles:
    headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: unknown)
    off: Off (priority 0, available: yes)
    active profile:
    sinks:
    bluez_sink.00_25_DB_15_AB_26.headset_head_unit/#2: Gioteck LP-1
    sources:
    bluez_sink.00_25_DB_15_AB_26.headset_head_unit.monitor/#4: Monitor of Gioteck LP-1
    bluez_source.00_25_DB_15_AB_26.headset_head_unit/#5: Gioteck LP-1
    ports:
    headset-output: Headset (priority 0, latency offset 0 usec, available: unknown)
    properties:

    headset-input: Headset (priority 0, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $

    1. lee at | | Reply

      i went through it again and everything connects fine but i dont get any record/playback

      index: 2
      name:
      driver:
      owner module: 25
      properties:
      device.description = “Gioteck LP-1”
      device.string = “00:25:DB:15:AB:26”
      device.api = “bluez”
      device.class = “sound”
      device.bus = “bluetooth”
      device.form_factor = “headset”
      bluez.path = “/org/bluez/hci0/dev_00_25_DB_15_AB_26”
      bluez.class = “0x200404”
      bluez.alias = “Gioteck LP-1”
      device.icon_name = “audio-headset-bluetooth”
      device.intended_roles = “phone”
      profiles:
      headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: unknown)
      off: Off (priority 0, available: yes)
      active profile:
      sinks:
      bluez_sink.00_25_DB_15_AB_26.headset_head_unit/#1: Gioteck LP-1
      sources:
      bluez_sink.00_25_DB_15_AB_26.headset_head_unit.monitor/#2: Monitor of Gioteck LP-1
      bluez_source.00_25_DB_15_AB_26.headset_head_unit/#3: Gioteck LP-1
      ports:
      headset-output: Headset (priority 0, latency offset 0 usec, available: unknown)
      properties:

      headset-input: Headset (priority 0, latency offset 0 usec, available: unknown)
      properties:

  48. leo at | | Reply

    it work well , Great Help !!

    Only a tiny issue that

    the sound is good before set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx.headset_head_unit

    but after change the sound become worse & “slow” …

  49. shreyas at | | Reply

    Hi Youness, Followed your guide and finally got my Bose SLM to stream audio from Rpi. Thank you!

  50. DasMaestro at | | Reply

    Hey Youness,

    I have been following the post for a while as I have been trying to get bluetooth input and output working for a while. After many hours and reinstalls and failed attempts, I took a break. But with the release of the RPi3b+ with the upgraded 4.2Bluetooth I was wondering if you or anyone who has been following your efforts and participating in the thread have found any difference with the new chip.

  51. ummar at | | Reply

    Hello Youness
    thanks for such a wonderful post. i have successfully connected a Bluetooth headset and recorded the audio (used pulse audio).
    the problem is poor quality of the audio as some of the guys have mentioned.
    i have tried to disable the wifi using
    “sudo ifconfig wlan0 down”
    before recording audio. and when audio is recorded i have enabled it
    “sudo ifconfig wlan0 up”
    but sound quality is still bad, please guide me what is the issue.
    also i plan to use a usb Bluetooth dongle for better audio recording
    https://www.aliexpress.com/item/-/32917016293.html
    they claim it can be used with raspberry pi. please suggest me will it solve the issue ? as disabling wifi during audio recording didn’t helped.
    Regards

  52. Ummar at | | Reply

    Thanks for your reply. But i am only recording the audio. After recording is done and audio file is saved, i am enabling wifi to send it to cloud.

    After that i download file from cloud and listen it on my PC

  53. Prashant Vitthal Zombade at | | Reply

    Hi,

    Thanks a lot for the detailed tutorial.

    “So I rebooted, removed the Bluetooth device and started again from the pairing step.”
    I did this 3 times but no luck. It throws ‘Failed to set card profile to ‘headset_head_unit’.
    My device indeed has a mic and it works with my phone.

    What exactly did you mean by ‘removed’?
    Is it required to stop my Bluetooth device before going for second attempt?

    Thanks in advance 🙂

    There is a space in below command. I guess we don’t need that.
    dpkg -l pulseaudio pulseaudio-module-bluetoot h

  54. Dave at | | Reply

    I’ve got a Pi 3 b + and am trying to connect a Bluetooth speaker. This speaker works with other devices, I’m running Raspbian Stretch on the Pi. Using bluetoothctl the speaker is both paired and trusted. The problem is the speaker and the Pi do not automatically reconnect when the speaker is turned on. Suggestions?

  55. M waqas at | | Reply

    hy dear, how to communicate mobile phone and Bluetooth headset through raspberry pi. please, give me solution.

  56. clem at | | Reply

    Thank you, very nice work ! 🙂

  57. Ricardo Penders at | | Reply

    Thanks for sharing this online, I couldn’t get my bluetooth speaker to work before but I followed your instructions and everything worked out exactly as you say so really great work for digging into this stuff, I know from my own experience that it can be a daunting task sometimes to get the most simple things to work as you anticipated because you’re a normal person and just expects at least something to happen as you’d normally do when you connect for example to your phone or tablet, right?

    Really I can’t thank you enough because you saved me a ton of time figuring it out on my own, which is why I already gave up on getting the sound working, I don’t really need it however I do have a strong urge to always get the most out of everything.

    Yeah, you’re one of the few good people online I think… Again, 1000x thx!

    I wish you have a great day today, have a great new year and all the best…

    Ricardo

  58. Cr4z33 at | | Reply

    Everything was OK until I arrived at step ‘pacmd list-cards’.

    There’s no mention about any kind of Bluetooth soundcard or device there (although I succesfully paired my August WS300 Bluetooth speaker thanks to your instructions).
    Running everything on a Raspberry Pi 3 B+ with latest update of Raspbian Desktop.

    Can you perhaps help me?
    Here is the result of my ‘pacmd list-cards’:

    3 card(s) available.
    index: 0
    name:
    driver:
    owner module: 6
    properties:
    alsa.card = “2”
    alsa.card_name = “QuickCam Pro 9000”
    alsa.long_card_name = “Logitech, Inc. QuickCam Pro 9000 at usb-3f980000.usb-1.2, high speed”
    alsa.driver_name = “snd_usb_audio”
    device.bus_path = “platform-3f980000.usb-usb-0:1.2:1.2”
    sysfs.path = “/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.2/sound/card2”
    udev.id = “usb-046d_0990_92EA4A29-02”
    device.bus = “usb”
    device.vendor.id = “046d”
    device.vendor.name = “Logitech, Inc.”
    device.product.id = “0990”
    device.product.name = “QuickCam Pro 9000”
    device.serial = “046d_0990_92EA4A29”
    device.form_factor = “webcam”
    device.string = “2”
    device.description = “QuickCam Pro 9000”
    module-udev-detect.discovered = “1”
    device.icon_name = “camera-web-usb”
    profiles:
    input:analog-mono: Ingresso «Mono analogico» (priority 2, available: unknown)
    off: Spento (priority 0, available: unknown)
    active profile:
    sources:
    alsa_input.usb-046d_0990_92EA4A29-02.analog-mono/#0: QuickCam Pro 9000 Mono analogico
    ports:
    analog-input-mic: Microfono (priority 8700, latency offset 0 usec, available: unknown)
    properties:
    device.icon_name = “audio-input-microphone”
    index: 1
    name:
    driver:
    owner module: 7
    properties:
    alsa.card = “1”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/bcm2835_alsa/sound/card1”
    device.string = “1”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    output:analog-mono: Uscita «Mono analogico» (priority 200, available: unknown)
    output:analog-stereo: Uscita «Stereo analogico» (priority 6000, available: unknown)
    off: Spento (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_audio.analog-stereo/#0: bcm2835 ALSA Stereo analogico
    sources:
    alsa_output.platform-soc_audio.analog-stereo.monitor/#1: Monitor of bcm2835 ALSA Stereo analogico
    ports:
    analog-output: Uscita analogica (priority 9900, latency offset 0 usec, available: unknown)
    properties:

    index: 2
    name:
    driver:
    owner module: 8
    properties:
    alsa.card = “0”
    alsa.card_name = “snd_rpi_googlevoicehat_soundcar”
    alsa.long_card_name = “snd_rpi_googlevoicehat_soundcard”
    alsa.driver_name = “snd_soc_googlevoicehat_soundcard”
    device.bus_path = “platform-soc:sound”
    sysfs.path = “/devices/platform/soc/soc:sound/sound/card0”
    device.string = “0”
    device.description = “snd_rpi_googlevoicehat_soundcar”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    profiles:
    input:analog-stereo: Ingresso «Stereo analogico» (priority 60, available: unknown)
    output:analog-stereo: Uscita «Stereo analogico» (priority 6000, available: unknown)
    output:analog-stereo+input:analog-stereo: Duplex stereo analogico (priority 6060, available: unknown)
    off: Spento (priority 0, available: unknown)
    active profile:
    sinks:
    alsa_output.platform-soc_sound.analog-stereo/#1: snd_rpi_googlevoicehat_soundcar Stereo analogico
    sources:
    alsa_output.platform-soc_sound.analog-stereo.monitor/#2: Monitor of snd_rpi_googlevoicehat_soundcar Stereo analogico
    alsa_input.platform-soc_sound.analog-stereo/#3: snd_rpi_googlevoicehat_soundcar Stereo analogico
    ports:
    analog-input: Ingresso analogico (priority 10000, latency offset 0 usec, available: unknown)
    properties:

    analog-output: Uscita analogica (priority 9900, latency offset 0 usec, available: unknown)
    properties:

  59. Cr4z33 at | | Reply

    Hi,

    although I paired succesfully my August WS300 Bluetooth speaker when I type ‘pacmd list-cards’ it doesn’t show up in the list of available sound cards…

    What shall I do now? 🙁

  60. Joku at | | Reply

    Finally! First of all, huge thanks to Youness! I spent 14 hours setting this all up. Sometimes I had a feeling that I just got lucky when things started to work, but nevertheless, it works now! I’m so satisfied!

    I guess I had some problems with multiple accounts first (then I just deleted the second account and made all the changes from one account). Actually, nothing worked after I did all as Youness told (At this point I didn’t get any cards to show up when pacmd list-cards) but when I got frustrated and removed the Pulseaudio and installed it again all started to work. (that was the lucky part).

    Most of the time went to figure out this script to automatically connect my Asus BT400 dongle to a Sony’s portable speaker (with mic). It would have been easy without mic..

    Remember you still have to do some of the steps to come at this point! To list at least some of those:
    Disabling the onboard bluetooth
    Installing USB dongle drivers
    Installing Pulseaudio and pulseaudio-module-bluetooth
    Pairing, trusting and connecting the speaker

    So here is the script!

    1. Create a new file bluetooth_auto.sh
    2. Copy, edit (MACs) and save.

    #!/bin/bash

    #Connect BT (Your bluetooth speaker or headset MAC address) (you may have to run the script once (just double click) before booting with the systemd to get this working. By adding this (bt connection) to the top I was able to get the script to work.)
    bluetoothctl << EOF
    connect xx:xx:xx:xx:xx:xx
    exit
    EOF

    sleep 10

    #Kill Bluealsa
    sudo killall bluealsa

    #Start Pulseaudio
    #optional#pax11publish -r
    pulseaudio –start

    #Connect BT (Your bluetooth speaker or headset MAC address)
    bluetoothctl << EOF
    connect xx:xx:xx:xx:xx:xx
    exit
    EOF

    sleep 5

    sudo hcitool cmd 0x3F 0x01C 0x01 0x02 0x00 0x01 0x01

    #Your bluetooth speaker or headset MAC address to all of these.
    pacmd set-card-profile bluez_card.xx_xx_xx_xx_xx_xx headset_head_unit
    pacmd set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx.headset_head_unit
    pacmd set-default-source bluez_ssource.xx_xx_xx_xx_xx_xx.headset_head_unit

    exit 0

    3. sudo chmod +x /your/file/destination/bluetooth_auto.sh

    Now lets set up the systemd service

    4. sudo nano /lib/systemd/system/bluetooth_auto.service
    5. Copy and paste this to the file. Ctrl + X, Y, Enter. (destination has to be exact to the .sh file you just created!)

    [Unit]
    Description=My Service

    [Service]
    Type=idle
    ExecStart=/your/file/destination/bluetooth_auto.sh

    [Install]
    WantedBy=multi-user.target

    6. sudo chmod 644 /lib/systemd/system/bluetooth_auto.service
    7. sudo systemctl daemon-reload
    8. sudo systemctl enable bluetooth_auto.service
    9. sudo reboot

    Thank you!

    Links to setting up the script.
    https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/ (Method 4: SYSTEMD)
    https://www.youtube.com/watch?v=eEuViHanjKI
    https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/

  61. Joku Toinen at | | Reply

    Finally! First of all, huge thanks to Youness! I spent 14 hours setting this all up. Sometimes I had a feeling that I just got lucky when things started to work, but nevertheless, it works now! I’m so satisfied!

    I guess I had some problems with multiple accounts first (then I just deleted the second account and made all the changes from one account). Actually, nothing worked after I did all as Youness told (At this point I didn’t get any cards to show up when pacmd list-cards) but when I got frustrated and removed the Pulseaudio and installed it again all started to work. (that was the lucky part).

    Most of the time went to figure out this script to automatically connect my Asus BT400 dongle to a Sony’s portable speaker (with mic). It would have been easy without mic.. By adding a bt connection command to the start I was able to get the script to work. “#pax11publish -r” is an optional line for pulseaudio start problems.

    Remember you still have to do some of the steps to come at this point! To list at least some of those:
    Disabling the onboard bluetooth
    Installing USB dongle drivers
    Installing Pulseaudio and pulseaudio-module-bluetooth
    Pairing, trusting and connecting the speaker

    So here is the script!

    1. Create a new file bluetooth_auto.sh
    2. Copy, edit (MACs) and save.

    #!/bin/bash

    #Connect BT (Your bluetooth speaker or headset MAC address)
    bluetoothctl << EOF
    connect xx:xx:xx:xx:xx:xx
    exit
    EOF

    sleep 10

    #Kill Bluealsa
    sudo killall bluealsa

    #Start Pulseaudio
    #pax11publish -r
    pulseaudio –start

    #Connect BT (Your bluetooth speaker or headset MAC address)
    bluetoothctl << EOF
    connect xx:xx:xx:xx:xx:xx
    exit
    EOF

    sleep 5

    sudo hcitool cmd 0x3F 0x01C 0x01 0x02 0x00 0x01 0x01

    #Set up Pulseaudio (Your bluetooth speaker or headset MAC address)
    pacmd set-card-profile bluez_card.xx_xx_xx_xx_xx_xx headset_head_unit
    pacmd set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx.headset_head_unit
    pacmd set-default-source bluez_ssource.xx_xx_xx_xx_xx_xx.headset_head_unit

    exit 0

    3. sudo chmod +x /your/file/destination/bluetooth_auto.sh

    Now lets set up the systemd service

    4. sudo nano /lib/systemd/system/bluetooth_auto.service
    5. Copy and paste this to the file. Ctrl + X, Y, Enter. (destination has to be exact to the .sh file you just created!)

    [Unit]
    Description=My Service

    [Service]
    Type=idle
    ExecStart=/your/file/destination/bluetooth_auto.sh

    [Install]
    WantedBy=multi-user.target

    6. sudo chmod 644 /lib/systemd/system/bluetooth_auto.service
    7. sudo systemctl daemon-reload
    8. sudo systemctl enable bluetooth_auto.service
    (you may have to execute the script (bluetooth_auto.sh) once (just double click) before booting.
    9. sudo reboot

    Thank you!

    Links to setting up the script.
    https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/ (Method 4: SYSTEMD)
    https://www.youtube.com/watch?v=eEuViHanjKI
    https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/

  62. Isabel García at | | Reply

    Hello!
    Thank you very much for improving answers about this problem, it is really headache the issue!

    However, trying to do the A2DP connection, with the command pacmd list-cards no results are shown.
    The answer of my terminal is: 0 card(s) available.

    Does it mean that the audio bluetooth which I connect to does not have A2DP card?

    Please, I need more information!

    Thank you in advance,

    I.

  63. Brad at | | Reply

    This tutorial is 100% awesome. Thank you for presenting it!

  64. Ayan Dey at | | Reply

    Hi Youness.. I have been trying this for 2days… But with failures.. I am using RASPBERRY pi 3 model b+. Does anything changes for that??
    I am trying to connect to HBS 730 using pi for voice recognition with SpeechRecognition module..
    But failing each time to establish a HSP OR HFP connection.. Awaiting reply..
    Regards…..

  65. Ayan Dey at | | Reply

    Hi Youness.. I have been trying this for 2days… But with failures.. I am using RASPBERRY pi 3 model b+. Does anything changes for that??
    I am trying to connect to HSB 730 headset using HSP OR HPF but failing….
    Can you kindly help me about this?

    Regards….

  66. Ayan Dey at | | Reply

    Also adding to previous post.. I uninstalled bluealsa rather killing it every time..
    Could that be a problem?

  67. Boris Iliev at | | Reply

    Hi Youness,
    I am attempting to set this up now with my Plattan ADV wireless headphones and I’m able to pair and trust the headphones. However, once I try to connect, it attempts to connect and then says failure : org.bluez.Error.Failed
    I did not kill bluealsa because it said no such process running iirc.

    If you could help me out that would be great!

  68. Ayan Dey at | | Reply

    Before making the speech recognition work I’m simply trying to record audio through mic. using HBS 730…. Failed a lot of time…

    As a workaround i was trying to install PulseAudio11.1 from git..
    but that shows….

    pi@raspberrypi:~ $ git clone git://anongit.freedesktop.org/pulseaudio/pulseaudioCloning into ‘pulseaudio’…
    remote: Counting objects: 66081, done.
    remote: Compressing objects: 100% (13523/13523), done.
    remote: Total 66081 (delta 55213), reused 62679 (delta 52484)
    Receiving objects: 100% (66081/66081), 12.46 MiB | 156.00 KiB/s, done.
    Resolving deltas: 100% (55213/55213), done.
    pi@raspberrypi:~ $ cd pulseaudio
    pi@raspberrypi:~/pulseaudio $ sudo apt-get build-dep pulseaudioReading package lists… Done
    E: You must put some ‘source’ URIs in your sources.list
    pi@raspberrypi:~/pulseaudio $

    Please help me with a way out…

    Getting frustrated with this

  69. Ayan Dey at | | Reply

    what ‘source’ shall I use?

    …………….Regards..
    May be I’m annoying you with this but FEEEEELING like hitting my head against the wall….

  70. Ayan Dey at | | Reply

    Yeh. Googling it basically returns to your posted solutions.. But that’s not working.. I’m not being able to getting it done..

    What do you think? What might the problem!??

  71. Ayan Dey at | | Reply

    Yeh i followed the exact steps..but still fails.. I am using the most recent version of
    Raspbian Stretch with desktop
    Image with desktop based on Debian Stretch
    Version:November 2018
    Release date:2018-11-13
    Kernel version:4.14
    Followed by update and upgrade… Not working

  72. Ayan Dey at | | Reply

    Upto connecting is all same but the last line
    bluez_card.xx_xx_xx_xx_xx_xx headset_head_unit

    Error
    Failed to set card profile to ‘headset_head_unit’.
    After hundred reboots also….

  73. Ayan Dey at | | Reply

    A2dp works fine with that i previously used that headset for months with my home theater

  74. Ayan Dey at | | Reply

    But these days by your process i tried the HSP/HFP first…
    Could that be any issue! Though i think may be not..
    I dont know…may be a ghost bug..
    Ha ha ha..

  75. Ayan Dey at | | Reply

    With anything can you directly connect to my system and check…?
    I don’t know may be asking for a stupid thing.. But if you get time.. Will it be possible for you?

  76. Ayan Dey at | | Reply

    Yes i also did the hcitool command..
    I also tried using a dongle.. A cambridge semiconductor one.. But same problem.. Though the headset works perfectly with my vaio laptop running on Windows 10

  77. Ayan Dey at | | Reply

    Ok then i will try after getting home making you control my RASPBERRY pi..may be 15mins max

  78. Ayan Dey at | | Reply

    Would you mind giving your watsapp number…

  79. Ayan Dey at | | Reply

    Im installing TEAMVIEWER on raspberry pi.. can you help please??

  80. Ayan Dey at | | Reply

    ok no probs… thanks by the way..
    ok then I would try connecting the a2dp first…

  81. Ayan Dey at | | Reply

    tried again with a2dp first. Works fine…
    but failed with HSP

  82. Ayan Dey at | | Reply

    systemctl status bluetooth
    returns->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ● bluetooth.service – Bluetooth service
    Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
    Active: active (running) since Mon 2019-03-11 19:56:52 IST; 10min ago
    Docs: man:bluetoothd(8)
    Main PID: 584 (bluetoothd)
    Status: “Running”
    CGroup: /system.slice/bluetooth.service
    └─584 /usr/lib/bluetooth/bluetoothd

    Mar 11 19:56:52 raspberrypi bluetoothd[584]: Endpoint registered: sender=:1.14 path=/A2DP/SBC/Source/1
    Mar 11 19:56:52 raspberrypi bluetoothd[584]: Failed to set privacy: Rejected (0x0b)
    Mar 11 19:56:56 raspberrypi bluetoothd[584]: Endpoint registered: sender=:1.24 path=/MediaEndpoint/A2DPSource
    Mar 11 19:56:56 raspberrypi bluetoothd[584]: Endpoint registered: sender=:1.24 path=/MediaEndpoint/A2DPSink
    Mar 11 19:56:56 raspberrypi bluetoothd[584]: RFCOMM server failed for Headset Voice gateway: rfcomm_bind: Address already in use (98)
    Mar 11 19:57:59 raspberrypi bluetoothd[584]: Endpoint unregistered: sender=:1.14 path=/A2DP/SBC/Source/1
    Mar 11 19:58:23 raspberrypi bluetoothd[584]: /org/bluez/hci0/dev_22_22_22_70_C7_2C/fd0: fd(24) ready
    Mar 11 19:59:22 raspberrypi bluetoothd[584]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connec
    Mar 11 20:04:11 raspberrypi bluetoothd[584]: /org/bluez/hci0/dev_22_22_22_70_C7_2C/fd1: fd(22) ready
    Mar 11 20:04:16 raspberrypi bluetoothd[584]: 22:22:22:70:C7:2C: error updating services: Input/output error (5)
    ~
    ~

  83. Ayan Dey at | | Reply

    pactl list cards
    Card #0
    Name: alsa_card.platform-soc_audio
    Driver: module-alsa-card.c
    Owner Module: 6
    Properties:
    alsa.card = “0”
    alsa.card_name = “bcm2835 ALSA”
    alsa.long_card_name = “bcm2835 ALSA”
    device.bus_path = “platform-soc:audio”
    sysfs.path = “/devices/platform/soc/soc:audio/bcm2835_alsa/sound/card0”
    device.string = “0”
    device.description = “bcm2835 ALSA”
    module-udev-detect.discovered = “1”
    device.icon_name = “audio-card”
    Profiles:
    output:analog-mono: Analog Mono Output (sinks: 1, sources: 0, priority: 700, available: yes)
    off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
    Active Profile: output:analog-mono
    Ports:
    analog-output: Analog Output (priority: 9900, latency offset: 0 usec)
    Part of profile(s): output:analog-mono

    Card #1
    Name: bluez_card.22_22_22_70_C7_2C
    Driver: module-bluez5-device.c
    Owner Module: 24
    Properties:
    device.description = “HBS-730”
    device.string = “22:22:22:70:C7:2C”
    device.api = “bluez”
    device.class = “sound”
    device.bus = “bluetooth”
    device.form_factor = “hands-free”
    bluez.path = “/org/bluez/hci0/dev_22_22_22_70_C7_2C”
    bluez.class = “0x240408”
    bluez.alias = “HBS-730”
    device.icon_name = “audio-handsfree-bluetooth”
    device.intended_roles = “phone”
    Profiles:
    headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 30, available: yes)
    a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: yes)
    off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
    Active Profile: off
    Ports:
    handsfree-output: Handsfree (priority: 0, latency offset: 0 usec)
    Part of profile(s): headset_head_unit, a2dp_sink
    handsfree-input: Handsfree (priority: 0, latency offset: 0 usec)
    Part of profile(s): headset_head_unit

  84. Ayan Dey at | | Reply

    trying now with
    ||/ Name Version Architecture Description
    +++-====================================-=======================-=======================-=============================================================================
    ii pulseaudio 12.2-4 armhf PulseAudio sound server
    ii pulseaudio-module-bluetooth 12.2-4 armhf Bluetooth module for PulseAudio sound server

  85. Ayan Dey at | | Reply

    It still failed
    I think I’ll give a try with a headset like you used

  86. Ayan Dey at | | Reply

    Can you help me with the model number of the headset you used

  87. Ayan Dey at | | Reply

    My headset HBS-730 working fine on Windows and also on android..
    Checked today morning also…
    I can figure it out,… Why not Raspberry pi..

  88. Ayan Dey at | | Reply

    Today I was able to record audio on pi using my mobile that has
    headset_audio_gateway: Headset Audio Gateway (HSP/HFP)

    pi@raspberrypi:~ $ bluetoothctl
    Agent registered
    [CHG] Device 04:92:26:99:16:EE RSSI: -54
    [bluetooth]# scan on
    Discovery started
    [CHG] Device 04:92:26:99:16:EE RSSI: -42
    [bluetooth]# pair 04:92:26:99:16:EE
    Attempting to pair with 04:92:26:99:16:EE
    [CHG] Device 04:92:26:99:16:EE Connected: yes
    Request confirmation
    pair 04:92:26:99:16:EE
    Failed to pair: org.bluez.Error.AuthenticationFailed
    [CHG] Device 04:92:26:99:16:EE Connected: no
    [bluetooth]# pair 04:92:26:99:16:EE
    Attempting to pair with 04:92:26:99:16:EE
    [CHG] Device 04:92:26:99:16:EE Connected: yes
    Request confirmation
    [agent] Confirm passkey 906241 (yes/no): yes
    [CHG] Device 04:92:26:99:16:EE Modalias: bluetooth:v001Dp1200d1436
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001103-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001105-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001106-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001112-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001115-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001116-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 0000112d-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001132-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001200-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001800-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 00001801-0000-1000-8000-00805f9b34fb
    [CHG] Device 04:92:26:99:16:EE UUIDs: 6455fffe-a146-11e2-9e96-0800200c9a67
    [CHG] Device 04:92:26:99:16:EE ServicesResolved: yes
    [CHG] Device 04:92:26:99:16:EE Paired: yes
    Pairing successful
    [CHG] Device 04:92:26:99:16:EE ServicesResolved: no
    [CHG] Device 04:92:26:99:16:EE Connected: no
    [CHG] Device D6:E4:CD:89:BC:37 RSSI: -86
    [bluetooth]# trust 04:92:26:99:16:EE
    [CHG] Device 04:92:26:99:16:EE Trusted: yes
    Changing 04:92:26:99:16:EE trust succeeded
    [bluetooth]# connect 04:92:26:99:16:EE
    Attempting to connect to 04:92:26:99:16:EE
    [CHG] Device 04:92:26:99:16:EE Connected: yes
    Connection successful
    [CHG] Device 04:92:26:99:16:EE ServicesResolved: yes
    [ASUS_X00TD]# scan off
    Discovery stopped
    [ASUS_X00TD]#
    [8]+ Stopped bluetoothctl

    name:
    driver:
    owner module: 35
    properties:
    device.description = “ASUS_X00TD”
    device.string = “04:92:26:99:16:EE”
    device.api = “bluez”
    device.class = “sound”
    device.bus = “bluetooth”
    device.form_factor = “phone”
    bluez.path = “/org/bluez/hci1/dev_04_92_26_99_16_EE”
    bluez.class = “0x5a020c”
    bluez.alias = “ASUS_X00TD”
    device.icon_name = “audio-card-bluetooth”
    profiles:
    a2dp_source: High Fidelity Capture (A2DP Source) (priority 20, available: unknown)
    headset_audio_gateway: Headset Audio Gateway (HSP/HFP) (priority 10, available: unknown)
    off: Off (priority 0, available: yes)
    active profile:
    ports:
    phone-output: Phone (priority 0, latency offset 0 usec, available: unknown)
    properties:

    phone-input: Phone (priority 0, latency offset 0 usec, available: unknown)
    properties:

    pi@raspberrypi:~ $ pacmd set-default-source bluez_source.04_92_26_99_16_EE.headset_audio_gateway
    pi@raspberrypi:~ $ parec b.wav
    ^Z
    [9]+ Stopped parec b.wav
    pi@raspberrypi:~ $ parecord c.wav
    Stream error: Entity killed
    pi@raspberrypi:~ $

  89. Ayan Dey at | | Reply

    Yeh..
    But the profile that worked for me is
    HSP-AG..
    Now I’ve to check if HSP works..
    I’ve ordered https://www.amazon.in/gp/aw/d/B07GPL53D6/ref=ya_aw_od_pi?ie=UTF8&psc=1
    working on CSR8645.. As my main project would be working on CSR8645..
    Lets see…

  90. Ayan Dey at | | Reply

    What headset did you use for the headset mic…?
    Can you suggest any..?

  91. Twigz at | | Reply

    Hi i’ve been trying to do step:

    Set the Bluetooth device as output audio:
    pacmd set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx.a2dp_sink

    However, i keep getting

    Sink bluez_sink.xx_xx_xx_xx_xx_xx.a2dp_sink does not exist.

    any idea why i would get that? Followed all the previous steps with no issues.

  92. BestElaine at | | Reply

    I have noticed you don’t monetize youness.net,
    don’t waste your traffic, you can earn additional cash
    every month. There is one good way that brings decent money,
    you can google it: money making by bucksflooder

  93. Keyur Modi at | | Reply

    At this line-
    pacmd set-card-profile bluez_card.B3_52_38_AA_AE_45 headset_head_unit

    Failed to set card profile to ‘headset_head_unit’.

    I got this error i rebooted but still i got this error

    please help me

  94. Seamus at | | Reply

    Hello,

    I have a Raspberry Pi 3B+, and a Bluetooth speaker called the ‘SoundCore mini’ mfd by Anker. Unfortunately, Anker does not publish the specifications of this speaker, but during a phone call to Anker’s tech support they informed me the SoundCore mini supports profiles: A2DP, HFP and AVRCP.

    I operate my RPi in “headless” mode without a GUI. My OS is Raspbian, and it is current. I have installed PulseAudio, and the following packages related to bluetooth are installed : bluez, bluez-firmware, pi-bluetooth.

    Using the `bluetoothctl` tool, I have been able to identify my SoundCore speaker, and to “pair” with it. However, each time I “connect”, the connection is immediately broken. I have yet to be able to successfully connect and play music through this speaker from the RPi (tho’ it happily plays tunes from my phone).

    I have two questions:

    1. Will your approach allow me to play music with my “built-in” BT hardware (i.e. no BT dongle)?

    2. Given the research and hard work you’ve done (very impressive!), is it your opinion that the BT hardware built into the RPi is lacking in performance and/or specifications. Put another way, would you ever buy a BT dongle that had the same specs and performance as the BT hardware in the RPi?

    Finally, thank you for the prodigious effort you have put into this.

    ~S

  95. Johannes H E Smeets at | | Reply

    this didnt work for me and screwed up my whole audio, how do i roll this back, removing speaker and adding it again didnt work, it connects but there is no sound

  96. Vaibhav at | | Reply

    Can I use it with my google assistant on raspberry pi 3 b+

  97. Ashish Gaur at | | Reply

    Hey Thanks,

    Your instructions worked well for me. The only thing is it seems I’m getting only a mono sound (not sure though). Is there any way to confirm whether the output is mono or stereo? And if it is mono, is there a way to get stereo sound?

  98. Mykhailo at | | Reply

    Hello, could you write same instruction for Raspberry Pi 4? with auto startup after reboot

  99. Gael Musoya at | | Reply

    Hi.
    I would firstly like to thank you for such an amazing explanation and assistance on this matter.
    I struggled with this for about a month.
    Now I am able to establish a proper HSP connection with my Bluetooth earpiece.

    I would per-apse like to also chip in by helping those who also manage to get a HSP connection
    but failed to get a better audio quality like I did in the past.

    Quoting bluetiger9: “..PulseAudio uses a hard-coded (e)SCO packet size of 48 bytes, instead of using the packet size negotiated at the eSCO connect (ex 60 bytes)…the SCO packets are received at a lower rate, which causes PulseAudio to send the SCO packets way too slow.”

    Solution:
    open: /etc/pulse/default.pa
    on the line where it is written:
    ifexists module-bluetooth-discover.so
    load-module module-bluetooth-discover
    endif

    Add: autodetect_mtu=yes
    It then become:
    ifexists module-bluetooth-discover.so
    load-module module-bluetooth-discover autodetect_mtu=yes
    endif

    This will allow a dynamic sizing of the packet.
    for more detail see: https://github.com/raspberrypi/linux/issues/2229

  100. Villads at | | Reply

    Have you measured the latency between the microphone input on the headphones and the output on the pi?

  101. Etienne at | | Reply

    Hi Youness

    Great work and thank you. I have a raspberry pi 4 model b and have gone through the process of paring/removing/paring my Sennheiser CX 6.00 BT a couple of times. It does utilize a password “0000” which I only entered once and was never prompted for it again. I can’t seem to set the headset_head_unit profile. In the pacmd list-cards print it lists the profile as not being available: Headset Head Unit (HSP/HFP) (priority 30, available: no). I do find this interesting as the product supports HFP but it does not list HSP in the specifications – Do you perhaps have any suggestions on a solution?

    Thanks and regards

    Etienne Bauscher

  102. Etienne at | | Reply

    Hi Youness

    I gave it one more try and it worked – Murphy’s Law.

    Thank you in anycase.
    Regards
    Etienne

  103. Dhrumil Panchal at | | Reply

    It works, Thank you so much Youness.

  104. Adam at | | Reply

    Hi Youness,

    I am trying to connect my Raspberry Pi 3B+ to my Amazon Echo Do. I want to use my echo as speakers. The problem is, it is not allowing me to set a2dp_sink as output audio. It is giving me the error. “Failed to set card profile to ‘a2dp_sink’.”

    I suspect it has something to do with the availability of the A2DP_Sink being “no” . Do you know how I may solve this issue? Thanks!

    profiles:
    a2dp_source: High Fidelity Capture (A2DP Source) (priority 20, available: unknown)
    a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 40, available: no)
    off: Off (priority 0, available: yes)

  105. Cardship at | | Reply

    Have followed all of this, device list and paired devices show my device
    Alsa is killed
    No audio on youtube

  106. Drake at | | Reply

    I tried this multiple times and when I run the code:

    part 1:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get autoremove
    sudo reboot

    part 2:

    sudo apt-get install pulseaudio pulseaudio-module-bluetooth
    dpkg -l pulseaudio pulseaudio-module-bluetooth
    sudo killall bluealsa (error: bluealsa: no process found)
    pulseaudio –start
    sudo bluetoothctl
    power on
    agent on
    default-agent
    scan on

    part 3:

    pair ##:##:##:##:##:##
    trust ##:##:##:##:##:##
    connect ##:##:##:##:##:## (error: Attempting to connect to ##:##:##:##:##:## Failed to connect: org.bluez.Error.Failed)

    It gives me 2 errors and does not work, what should I do?

  107. Hanzala Ibn Zahid at | | Reply

    Hi i have a cheap bluetooth headset. I follow every step in your tutorial and still get no audio or audio which is not audible. i alsa don’t get any errors. My headset works ok with smart phone. plz help

    Is there a way to automate this whole proccess. I am making an app using python speech_recognition and pyttsx3. these require clear mic input. plz help on this too

  108. Hanzala Ibn Zahid at | | Reply

    I can’t get audio input from mic. plz help.

  109. Ken Miles at | | Reply

    I don’t know this case still alive but I would like to share my experience about this issue. My main problem was low quality voice, I am using JBL 2 Go + USB Dongle (on board is disabled) and I know there is a micro inside. I don’t know why I am not an expert but based on my research from posts that you shared this speaker always connecting with HSP module. Fir this reason voice quality be *hitty…

    Just I paired my speaker from GUI and I select BT for output voice. till now everything as expected, low quality sound and other problems.

    I learned my mac based in these posts. I created my commands in notepad and I have created my bash script. Because the problem even when you apply the guide in every reboot speaker connects again with HSP…

    Just you need to do is kill the process and connect the speaker again.

    #!/bin/bash

    sudo killall bluealsa
    sleep 1
    pulseaudio –start
    sleep 1

    bluetoothctl << EOF
    connect cc_12_dd_ff_aa_bb
    exit
    EOF

    sleep 10

    sudo killall bluealsa
    sleep 1
    pulseaudio –start
    sleep 1

    pacmd set-card-profile bluez_card.cc_12_dd_ff_aa_bb a2dp_sink
    sleep 1
    pacmd set-default-sink bluez_sink.cc_12_dd_ff_aa_bb.a2dp_sink
    echo "bye bye"

    But just I failed about to make this as a service, I am pretty sure I have done all guidance bit and byte but no…

    I don't know how can I check or see the logs but it does not work for me…

    So with dongle now I can listen a better quality sound without any interruption.

    Thank you for your valuable information.

  110. Kiran at | | Reply

    Thank you! It worked perfectly!

  111. Anonymous at |

    […] […]

  112. Leo at | | Reply

    Hi everyone,

    I managed to connect my raspberry pi 3b+ to my car system, via Bluetooth and using A2DP. If I switch to a Bluetooth source I can listen to some music with very nice sound quality.

    But, if I switch the source to Tuner, I can’t play anything. I guess it requires HFP support, but after reading some of the documents available I’m even more confuse …

    I would like to play some notifications (wav files saying new mail arrived), I don’t even mind any “ring message”.

    Tried ofono, hsphfpd, nOBEX but nothing seems to work for me…. I would like to just use the Raspberry, but any of the previous solutions required me to use an external modem (or sound card)…

    Maybe someone can point me in the correct direction.

    Thanks,
    Leo

  113. RPiRadio – Stijn D'haese at |

    […] and select the correct profile with set-card-profile and set-default-sink. More info can be found here. Important: to exit pacmd, push the keyboard-shortcut Ctrl+d. Using the command exit or quit, […]

  114. Ash at | | Reply

    I can confirm as of 10 Sep 2020, this is a successful solution for connecting my RPi 3B+ to my Sony Headphones using onboard bluetooth for sound output. Didn’t try mic input. Basically the terminal commands to install Pulseaudio, pair device and A2dp sink to route audio. GUI doesn’t work, even with the latest Raspberry OS 32bit (which was previously called Raspibian). Probably can write a script with the known BT address of your headphones for easier repeated connection.

    However, this seems to have broken something in Chromium as YouTube sound is now choppy when previously there was no problem. Only way to fix it seems to be a clean reinstall of Raspberry OS/Raspibian. Reinstall of Chromium didn’t fix it. Don’t know what broke. Local video/audio files played with VLC are fine.

    In the end, i got myself a cheap external Bluetooth transmitter connected to my HDMI TV (HDMI sound out on the RPi) and abandoned the onboard Bluetooth of the RPi. I could also connect the external BT transmitter to the 3.5mm jack of the RPi directly but not sure if sound will be in Stereo (that’s another topic altogether).

    TLDR; Get an external Bluetooth transmitter. This seems to be the fastest and easiest solution with the least problems. Onboard BT solution would be great if the Chromium issue can be fixed.

  115. Ash Syed Abu Bakar at | | Reply

    Posted some latest findings to fix Chromium Youtube stuttering but didn’t come out?

  116. […] took a while to connect my Bluetooth speaker as a mic/speaker. This solution from Youness worked for me. Only one of the 3 speakers I had worked, but at least one did. To ensure that your […]

  117. Mark at | | Reply

    Hello,

    Just wanted to know if it is possible to pair multiple headsets to one raspberry Pi.

    thanks

  118. Paul Simpson at | | Reply

    Hi Youness. This is a brilliant post, with lots of very interesting and useful discussion. A big thank you.

    A ‘quick’ question from me then. I’m thinking about making an intercom system, with an Rpi connected via Bluetooth to two headsets, so that 2 people can chat to each other in a noisy environment (on the deck of a boat), within the range limits of Bluetooth. Question – given the problems you and others have discovered, am I wasting my time?

    Many thanks
    Paul S

  119. Vegz78 at | | Reply

    Thank you, Youness!

    Great article and worked great on my RPi4 with a Sony bluetooth headset.

    If others have annoying mono sound to get out of the way first, too, please see:
    https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=257785&sid=p1572004#p1572004

    Br,
    Vegard

  120. pcace at | | Reply

    Hi, thank you so much for your post! i was looking around literally weeks to find this hcitool cmd…

  121. DaMoGan at | | Reply

    Who would think that an over five year old post is still relevant, but it is! I have a new Raspberry Pi 4 Model b (8GB) with a Bose Revolve+ SoundLink Bluetooth speaker. I’d gotten to the point with other documentation of getting it paired and connected. (I had to go the CLI route, the BT app in the task bar would never show any BT devices). However, there was no sound. Following your guidance, I was able to actually get the speaker working!

    I’m on Rapbian 11 (bullseye) and it seems that PulseAudio is the default now, so I didn’t need to start it or kill bluealsa. I didn’t try the HSP part as I’m just using this as a speaker.

    Just wanted to post to say thanks to Youness, and so that others know this is still a viable solution!

Please comment with your real name using good manners.

Leave a Reply