Raspberry Pi 3 Raspbian Sretch Bluetooth Setup BlueAlsa and Pulse Audio - drumfreak/homebridge-bluetooth-soundbutton GitHub Wiki

In March of 2018, RASPBIAN STRETCH was released for Raspberry Pi and major updates to the bluetooth and audio handling have been implemented. For example, Pulse Audio is no longer recommended or required, as bluez or BlueAlsa have replaced the older stuff. In my experience, I started off with Jesse and later decided to backup my /home/pi and /etc configuration files, and start fresh with Stretch. To do that, I used a separate memory card and setup Raspberry Pi Raspbian Stretch default (non N00bs) install.

The Bluetooth on Raspbian Stretch Bluez-Alsa / BlueAlsa with or without PulseAudio Conundrum

Somehow, bluetooth became a serious mess with Alsa, especially on the Raspberry Pi Rasbian Stretch OS. I spent days researching, trying different things, and so far, these are the most useful links I have found and tested.

The next link seems the best solution right now if you want to combine multiple audio outputs into a single aggregate device through something like PulseAudio`` (like playing across multiple bluetooth speakers) It does not use BlueAlsa which at this point I am in favor of due to the massive amount of work BlueAlsa package still needs to fix a few things and possibly incorporate an alsa plugin for the pcm that allows it to be used as 'multi' or 'dmix'.

See @dlech's comment, on the previous article, there was something missing that made all of this work for me using Pulseaudio and bluetooth:

@dlech mentioned adding the additional line for module-bluetooth-policy so that I could actually trust and pair my devices. By adding the following lines and running pulseaudio as a system user (root) despite the warnings in my console telling me something was wrong with me... I was able to pair, trust, and a bluetooth a2dp sink was created and my speakers started working with:

### Automatically load driver modules for Bluetooth hardware /etc/pulseaudio/system.pa
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
# Test audio MP3
/usr/bin/mplayer -ao pulse ~/sounds/fckYes.mp3

Additional Links

I learned a lot from these links but never really got all the bluetooth speakers playing at once, so these are just useful hints from the rabbit hole.

Bluetooth on Raspberry Pi 3 with Raspbian Stretch Notes:

  • Disable onboard WIFI and use onboard LAN if sound is studering:

Warning, WARNING and W_A_R_N_I_N_G!!

If your audio is choppy you may consider turning off Wifi and disabling it all together, or use a USB wifi adapter, or do the opposite and use a USB Bluetooth Dongle and disable the onboard bluetooth or use it for other things.

This will disable your wifi, so if you run a headless Raspberry Pi, make sure you have a network cable!

sudo nano /boot/config.txt

Add the following line:

dtoverlay=pi3-disable-wifi

Reboot:

sudo reboot

Now attempt to play your audio and see if the chop or static goes away.