Using Bluetooth Speakers

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
chocobo
Posts: 6
Joined: Sun Nov 01, 2020 8:39 am

Using Bluetooth Speakers

Post by chocobo »

Hello,

I can pair and trust my Bluetooth speakers via the GUI Bluetooth Manager and the command line bluetoothctl, but both fail when I try to connect.

The error when I connect to Audio Sink on GUI is: "Connection Failed: blueman.bluez.errors.DBusFailedError: Protocol not available"
on bluetoothctl when I "connect <MAC address>" the error is: "Failed to connect: org.bluez.Error.Failed"

I have installed latest pi-bluetooth and pulseaudio-module-bluetooth

What else can I do or is even possible to stream audio via RaspberryPi through BT? although I don't see why not?

Thank you and regards.
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: Using Bluetooth Speakers

Post by MichaIng »

Many thanks for your report.

Is it an RPi model with onboard WiFi+Bluetooth or do you use a dongle?

Note that DietPi by default configures ALSA for audio, not PulseAudio. If you use the latter, please assure that its service is up and running and e.g. can be used to play sound through 3.5mm jack speakers or HDMI.

There is also a way to configure Bluez to use ALSA instead of PulseAudio. Have a look at these two issues:
- https://github.com/MichaIng/DietPi/issues/3456
- https://github.com/MichaIng/DietPi/issues/3611
chocobo
Posts: 6
Joined: Sun Nov 01, 2020 8:39 am

Re: Using Bluetooth Speakers

Post by chocobo »

Hello,

Thank you and sorry for being incomplete. It's a Pi 3B so it's with the built-in BT.

Regards.
chocobo
Posts: 6
Joined: Sun Nov 01, 2020 8:39 am

Re: Using Bluetooth Speakers

Post by chocobo »

Hi,

I was able to connect following the steps from issue #3456. That was my issue too, the ALSA, and I had to manually add the entries to the .conf file. I got them connected, BUT... there is no audio output...just some pops and hiss when playing a video for example. Tried the speaker volume and the video player volume, no luck. What I could not find was a system volume switch, maybe thats it?

Thanks for the advice.
chocobo
Posts: 6
Joined: Sun Nov 01, 2020 8:39 am

Re: Using Bluetooth Speakers

Post by chocobo »

Hi,

For good measure, I tried an AUX cable on my speaker and ran dietpi-config > Audio Options and set the soundcard to rpi-bcm2835-3.5 Still no audio output.

It did install alsa-utils which came with a system volume switch.

So I tried to connect BT again and it connected no problem, but again no audio and the system volume did nothing.

Here is the output of my aplay -l

Code: Select all

root@DietPi:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 3/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
Thank you and regards.
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: Using Bluetooth Speakers

Post by MichaIng »

PulseAudio and plain ALSA might interfere currently, I'm not sure how well this works together. First I'd assure that the 3.5mm jack works the one or the other way. In case you want to go with plain ALSA (and follow the links I posted to install + configure bluez-alsa manually, then I'd purge pulseaudio: apt purge pulseaudio

If you use PulseAudio, which is natively supported by bluez (so in theory easier to setup), then you might need to remove /etc/asound.conf, not 100% sure :?.
A way to check PulseAudio available output devices, especially when the Bluetooth audio module is installed: pactl list
chocobo
Posts: 6
Joined: Sun Nov 01, 2020 8:39 am

Re: Using Bluetooth Speakers

Post by chocobo »

Hi,

I purged pulseaudio.

I am using ALSA now and alsa-utils + pi-bluetooth to go with standard dietpi.
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: Using Bluetooth Speakers

Post by MichaIng »

Okay, do you need help with the bluez-alsa setup?

Ah, I just remember that on RPi there is an APT package available for it: apt install dbus bluealsa
It includes a service and an ALSA config and looks like it could should work OOTB. I added dbus package as well as at least the bluealsa service contains some dbus policy config.
chocobo
Posts: 6
Joined: Sun Nov 01, 2020 8:39 am

Re: Using Bluetooth Speakers

Post by chocobo »

Ok.

Hereś what I did:

I purged everything and started from scratch using dietpi-config > Advanced Options > Bluetooth On

so I guess that installed bluez and alsa and Iḿ able to connect to my BT speaker, but no audio,

So I am trying now corded with AUX. So I changed dietpi-config > Audio Options > rpi-bcm2385-3.5mm (originally HDMI)

Still no audio.

In alsamixer, the soundcard settings were still in HDMI. So F6, change to headphones. Somehow, I can´t make this command stick. There is no option to save, when you exit the window, it reverts back to HDMI even though dietpi-config has it at the 3.5mm setting.

Thank you.
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: Using Bluetooth Speakers

Post by MichaIng »

The thing with the 3.5mm jack is known: https://github.com/MichaIng/DietPi/issues/3887
RPi kernel/firmware made some breaking changes to their sound card interface. Will be fixed with the next DietPi version, although it might make switching the sound device more complicated as of the not-to-great changes by RPi Foundation :(.

As I said above, bluez alone does NOT support Bluetooth audio, so it is expected that you attempt fails. As I said, you need to install an additional package manually. Run the following two commands and see if this allows Bluetooth audio output:

Code: Select all

rm /etc/asound.conf
apt install dbus bluealsa
Post Reply