Bluetooth Speaker Plugin

Well sadly i guess the developer of this plugin has no time for it, but is still alive, that is good in general. :slight_smile:

I was able to install this one as many others on older release of volumio, but wasnā€™t satisfied with the performance over all as the firmware and everything wasnā€™t that smooth experience for me on a raspberry pi zero w as it is with the newest volumio version available. So whats the deal? You still donā€™t neet this plugin at all to get your bluetooth speaker working the ā€œmanualā€ way works still fine!

An ssh session to volumio and creating the following shell script helps a lot :slight_smile: Make it executeable after all and run it.

[code]#!/bin/bash

echo ā€œInstalling Bluetooth Dependenciesā€
sudo apt-get update
sudo apt-get install -y libasound2-dev dh-autoreconf libortp-dev bluez pi-bluetooth bluez-tools libbluetooth-dev libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libsbc1 libsbc-dev

echo ā€œCloning Bluez-Alsa repoā€
cd /tmp
git clone -b v1.2.0 --single-branch https://github.com/Arkq/bluez-alsa.git

echo ā€œBuilding Bluez-Alsaā€
cd bluez-alsa
autoreconf --install
mkdir build && cd build
ā€¦/configure --disable-hcitop --with-alsaplugindir=/usr/lib/arm-linux-gnueabihf/alsa-lib
make

echo ā€œInstalling Bluez-Alsaā€
sudo make install

cat > /lib/systemd/system/bluezalsa.service <<EOC
[Unit]
Description=BluezAlsa proxy
Requires=bluetooth.service
After=bluetooth.service
[Service]
Type=simple
User=root
Group=audio
ExecStart=/usr/bin/bluealsa --disable-hfp
[Install]
WantedBy=multi-user.target
EOC

sudo systemctl daemon-reload
sudo systemctl enable bluezalsa.service

#requred to end the plugin install
echo ā€œplugininstallendā€[/code]

After the process is done it can take a while, as some things need to be compiled.

Reboot the system and checkout if the service is running:

systemctl status bluezalsa

If yes then go for pairing your raspy with your speaker, make it a trustable and connect at least.

bluetoothctl [bluetooth]# power on [bluetooth]# agent on [bluetooth]# default-agent [bluetooth]# scan on [NEW] Device xx:xx [bluetooth]# pair xx:xx [bluetooth]# trust xx:xx [bluetooth]# connect xx:xx [bluetooth]# exit

Well thatā€™s almost it!

Two more steps and you are there:

First of all you could patch the mpd.conf in /etc which is not a good idea at all! Just do a search for a mpd.conf volumio config template as root:

sudo -s

cd / find -name mpd.conf.*

Well you will see a result with two pretty long path and mpd.conf.tmpl so here you go edit this file and put after last output device following:

After that create a new hidden file in your /home/volumio directory with the name: .asoundrc with following content:

Specify the parameters of the Bluetooth connection

defaults.bluealsa {
     interface "hci0"            # host Bluetooth adapter
     device "xx:xx:x:x:xx:x"     # Bluetooth headset MAC address
     profile "a2dp"
}

change the mac address to the one you had seen during pairing process, donā€™t forget of course to put you speaker into pairing process before trying and thatā€™s it!

If you start now playing something from webinterface a webradio or local files it should work like a charm, if not and you have a choppy sound as i discovered for the first time then you have probably enabled the wlan and bluetooth module at same time. This is the root of the issue. To solve it i used an old wlan usb stick and disabled the internal one. Same should work if you use an external bluetooth module and disable the internal. This can be done via config.txt in /etc.

In general if you donā€™t change you bluetooth speakers like some people their socks, everyday, it is a way to have nice small internet radio for a bluetooth speaker.

However the scapcast plugin donā€™t work with bluetooth devices as it need to be implemented somehow, the only way it should wirk would be to use a direct soundcard connection to the speaker.

Regards,

Fossy

Thanks Fossy for this quite good manual.

In my setup I have to create a file /etc/asound.conf instead of ~/.asoundrc to get it running

# Specify the parameters of the Bluetooth connection defaults.bluealsa { interface "hci0" # host Bluetooth adapter device "xx:xx:x:x:xx:x" # Bluetooth headset MAC address profile "a2dp" }

But I still have a few problems.

  • I couldnā€™t change the volume over the GUI this is only possible on the speaker
  • Airplay is not working
  • after the speaker is connected I have to press stop and then play in the GUI to get a sound, is it possible to do this automatically

Thanks.

Regards
Kressinger

Iā€™m trying to enable Spotify Streaming to a Bluetooth speaker. Anyone had success? Trying to edit the spopd.conf file but nothing works.

@Kresinger, I have same issues as you described, but in general it works fine so far. I guess the volume control isnā€™t implemented in this solution unfortunately.

@Danielcirillo: Spotify I never tried with volumio but did you changed the default Alsa mixer device?

Sorry for the log absence, but work and other projects took a lot of time.

But there also good news:
yesterday I started a PR for changes in Volumio UI to integrate the needed features for pairing devices in the web interface.
When this is integrated Iā€™ll release an improved version of the plugin to the official repository to ease installation.

Yes, the songs in the internal storage or the USB device worked perfectly, but the Spotify just on the ps2 jack.

Just curious,
I got a second RaspberryPi behind my TV for Kodi.
And that already has support for Bluetooth speakers.

Why is Bluetooth Speakers support so hard to make it working for Volumio ?
This isnā€™t a bash or something just curious.

Sounds indeed like good news. Will this plugin as well have probably have support for SnapCast Plugin? This would be just <3

Hello,

its my first post, but I am using volumio more than one year and its great - thank you :smiley:

Like all the posting user here I find that bluetooth is a very important and usefull feature for volumio - both to send all music to all blutooth-devices and to receive it from all devices.

I use an RP3 with allo-boss and actual Volumioversion 2.502. I installed the plugin, it compiled and installed succesfull but the service didnā€™t start - the same issue as sonos-killer and others. Deinstall didnā€™t work, also I tried the script of fosphatic duke - it works and I can use bluetoothctl. I just didnā€™t try to pair yet - its very ā€œmanualā€ but I will give him a chance.

My question - the plugin seems to be the best option, but does it work with an actual Version of volumio? Sonos-killer did a clean install, but get the same issue. Is there a chance for my hardware?

Hey there,

yeah Iā€™m upgrading always my rpi3+ and both rpi zero with volumio on it to latest version. Itā€™s working fine so far on each version. The manual part you have to do only once as long you put the trust to a device and this device donā€™t forget your volumio pie :wink:

When i boot up the jbl bluetooth speaker it connects always automaticly with the pie as long no new devices are paired with this speaker. It has a limitation of 3 trusted devices as far i know. So pie and wifes as my smartphones are paired with that speaker. Well however the phone of my wife is connecting always faster then any other device, when bluetooth enabled, but beside that itā€™s very running stable so far.

However i wish it would be implemented by default from the volumio team and a support for multi room audio would make this really a very interesting combination for people who donā€™t want to buy sonos, like me. :slight_smile:

Reagrds,

Fossy

Hi forum members,

Iā€™m happy to report that I have a new RPI 3 A+ set up for streaming to A2DP speakers and things are working except for volume control from the Volumio GUI.
MPC volume control works fine and I use M.A.L.P from my SmartPhone to play songs, etc.
Can someone guide me to the corresponding documentation that will help me understand how to get the GUI volume control to use MPC to set the volume?

Regards,

Seurat

Hello,

Few months has been passed since this positive news, that Bluetooth control will be integrated to the Volumio UI.
Is there any progress you could share, geeks-r-us?

I am in the middle of integrating Volumio to my home audio system, but as Bluetooth connectivity is mandatory on this case, I am really interested in to this feature.

Thank you in advance!

Hi.

I am trying last two days to get this working, but it does not want to.
During the script install I get this error: Building Bluez-Alsa
aclocal: warning: couldnā€™t open directory ā€˜m4ā€™: No such file or directory
And at the end when I make all of the steps, I can connect to my BT speaker, it is also connected, but it does not want to play any music. It play on the audio jack, but nothing over BT.

Do you have any idea what could be wrong?

Also if I try to install the plugint over the UI it does not work. It says that the plugin ca not be started and in the settings there is nothing.

Any idea would be great.

Volumio version 2.522

Thank you, Uros

Hi There,

well Iā€™m on latest available volumio version and the plugin still works like a charm. Do you followed the tutorial how-to what I have provided in this thread? If not I would suggest you to follow it, at least it should lead to the usable result, well at least as long you donā€™t fear the shell. :slight_smile:

Regards

Fossy

Hi, yes I did follow the instructions. Actually several times :slight_smile: And yes, I tried it over ssh as well as over the Web. No luck for me it seemsā€¦ :frowning:

Will try it out once more time.

Thanks!

Hi,

Are there any news about the UI integration into Volumio UI.

This is a great improvement for Volumio ā€¦ but it seems that it tooks too many time to get it officially integrated.

Regards

JĆ¼rgen

I just want to confirm, that I managed to get it work with a slightly modified variant of the instructions posted by ā€œFosphatic Dukeā€ :smiley:

I am using Volumio 2.565 on raspi 3ā€¦

I had to change the posted installation script in line 21:

[code]#!/bin/bash

echo ā€œInstalling Bluetooth Dependenciesā€
sudo apt-get update
sudo apt-get install -y libasound2-dev dh-autoreconf libortp-dev bluez pi-bluetooth bluez-tools libbluetooth-dev libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libsbc1 libsbc-dev

echo ā€œCloning Bluez-Alsa repoā€
cd /tmp
git clone -b v1.2.0 --single-branch https://github.com/Arkq/bluez-alsa.git

echo ā€œBuilding Bluez-Alsaā€
cd bluez-alsa
autoreconf --install
mkdir build && cd build
ā€¦/configure --disable-hcitop --with-alsaplugindir=/usr/lib/arm-linux-gnueabihf/alsa-lib
make

echo ā€œInstalling Bluez-Alsaā€
sudo make install

sudo cat > /lib/systemd/system/bluezalsa.service <<EOC
[Unit]
Description=BluezAlsa proxy
Requires=bluetooth.service
After=bluetooth.service
[Service]
Type=simple
User=root
Group=audio
ExecStart=/usr/bin/bluealsa --disable-hfp
[Install]
WantedBy=multi-user.target
EOC

sudo systemctl daemon-reload
sudo systemctl enable bluezalsa.service

#requred to end the plugin install
echo ā€œplugininstallendā€[/code]

In addition I didnā€™t have to create a .asoundrc - I modified the mpd.conf.tmpl with the following modified statements:

audio_output { type "alsa" name "Logitech BT Adapter" device "bluealsa:HCI=hci0,DEV=xx:xx:xx:xx:xx:xx,PROFILE=a2dp" mixer_type "software" }

Donā€™t forget the pair-and-trust-stuff:

bluetoothctl [bluetooth]# power on [bluetooth]# agent on [bluetooth]# default-agent [bluetooth]# scan on [NEW] Device xx:xx [bluetooth]# pair xx:xx [bluetooth]# trust xx:xx [bluetooth]# connect xx:xx [bluetooth]# exit

This solution was inspired by comments on https://geeks-r-us.de/2017/08/18/bluetooth-a2dp-lautsprecher-am-raspberry-pi/

One aspect I struggled with:
To test the playback within Volumio, it is necessary to stop and start the stream after restarting the mpd deamonā€¦
ā€¦to test the pure bluetooth connection, use aplay with a wav file:

aplay -D bluealsa:HCI=hci0,DEV=xx:xx:xx:xx:xx:xx,PROFILE=a2dp testfile.wav

Have fun! :smiley:

Thanks maverick, but when i test it with the aplay command it is working. But in Volumio when i start a stream/song there is no sound.
Do i need select the device some where ?

No, you donā€™t have to select the device - it will just ā€œcopyā€ the output to the bluetooth device within alsa. I am using the audio-jack as output device within volumio.

Some things you can double-check:

  • Did you reboot the pi and tested again?
  • Did you modify the file ā€œmpd.conf.tmplā€?
  • Did you replace the placeholder xx:xxā€¦ with the correct address of your device? (the same you used for aplay)
  • Please check the (generated) file /etc/mpd.conf - your modifications should be placed there automatically. If not, edit it manually according to the template and restart the mpd deamon.
  • Maybe the device is disabled or muted within alsa - you can use the mixer to check that - I donā€™t know the concrete commands - but google willā€¦ :wink:

I hope, these hints will help you a little bit furtherā€¦
ā€¦good luck and best wishes for success!

One more aspect:
According to some other forum posts - this solution will not work for spotifyā€¦

solved - only volume setting is not possible - not an Bluetooth box, not on webfront