Bluetooth Speaker Plugin

Discuss, contribute and orient Volumio development!

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.

Bluetooth Speaker Plugin

Postby Fosphatic Duke » Thu Sep 06 2018 07:42

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

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 :) Make it executeable after all and run it.

Code: Select all
#!/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"


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:

Code: Select all
systemctl status bluezalsa


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

Code: Select all
    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:

Code: Select all
sudo -s

Code: Select all
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:

audio_output {
type "alsa"
name "bluealsa"
device "bluealsa"
mixer_type "software"
}


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
User avatar
Fosphatic Duke
Fresh off the boat
Fresh off the boat
 
Posts: 6
Joined: Fri Aug 31 2018 16:25

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.


Bluetooth Speaker Plugin

Postby kressinger » Wed Oct 03 2018 17:08

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

Code: Select all
# 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
Random avatar
kressinger
Fresh off the boat
Fresh off the boat
 
Posts: 1
Joined: Wed Oct 03 2018 16:53


Bluetooth Speaker Plugin

Postby danielcirillo » Thu Oct 04 2018 19:50

I'm trying to enable Spotify Streaming to a Bluetooth speaker. Anyone had success? Trying to edit the spopd.conf file but nothing works.
Random avatar
danielcirillo
Fresh off the boat
Fresh off the boat
 
Posts: 2
Joined: Thu Oct 04 2018 19:48


Bluetooth Speaker Plugin

Postby Fosphatic Duke » Sun Oct 07 2018 12:28

@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?
User avatar
Fosphatic Duke
Fresh off the boat
Fresh off the boat
 
Posts: 6
Joined: Fri Aug 31 2018 16:25


Bluetooth Speaker Plugin

Postby geeks-r-us » Mon Oct 08 2018 10:05

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.
Visit my blog about this and other DIY projects: http://www.geeks-r-us.de
If you like my plugins you can support me by buying me some coffee: https://www.buymeacoffee.com/YdV7B1rex
Random avatar
geeks-r-us
Serious Listener
Serious Listener
 
Posts: 61
Joined: Tue Apr 18 2017 22:28


Bluetooth Speaker Plugin

Postby danielcirillo » Tue Oct 09 2018 13:05

Fosphatic Duke wrote:@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?



Yes, the songs in the internal storage or the USB device worked perfectly, but the Spotify just on the ps2 jack.
Random avatar
danielcirillo
Fresh off the boat
Fresh off the boat
 
Posts: 2
Joined: Thu Oct 04 2018 19:48


Bluetooth Speaker Plugin

Postby AWS1971 » Tue Oct 23 2018 08:02

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.
Random avatar
AWS1971
Fresh off the boat
Fresh off the boat
 
Posts: 3
Joined: Sun Oct 21 2018 14:22


Bluetooth Speaker Plugin

Postby Fosphatic Duke » Sat Oct 27 2018 09:08

geeks-r-us wrote: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.


Sounds indeed like good news. Will this plugin as well have probably have support for SnapCast Plugin? This would be just <3
User avatar
Fosphatic Duke
Fresh off the boat
Fresh off the boat
 
Posts: 6
Joined: Fri Aug 31 2018 16:25


Bluetooth Speaker Plugin

Postby mmoin » Wed Dec 12 2018 18:05

Hello,

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

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?
User avatar
mmoin
Fresh off the boat
Fresh off the boat
 
Posts: 2
Joined: Sat Dec 01 2018 15:52


Bluetooth Speaker Plugin

Postby Fosphatic Duke » Thu Jan 10 2019 12:06

mmoin wrote:Hello,

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

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 ;)

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. :)

Reagrds,

Fossy
User avatar
Fosphatic Duke
Fresh off the boat
Fresh off the boat
 
Posts: 6
Joined: Fri Aug 31 2018 16:25

PreviousNext

Return to Development talks

Who is online

Users browsing this forum: No registered users and 0 guests