BlueTooth

Suggestions/requests/ideas for RuneAudio core features and functions

Re: BlueTooth

Postby pstout7 » 03 Oct 2017, 04:30

@crucerio A bit of a necropost here, but I am wondering if you had any success with the github code that you mentioned in your previous post. I have a Raspberry Pi3 with an Allo Piano 2.1 DAC and I would love to use Bluetooth as an input.
pstout7
 
Posts: 1
Joined: 03 Oct 2017, 04:26

Re: BlueTooth

Postby kailua » 27 Feb 2020, 20:12

Hello,

I know, time has passed and I don't know if this is still an issue in Runeaudio (I am using RuneAudio+R e2), but, I found a very easy solution to get a2dp bluetooth audio from your phone to a Raspberry Pi 3 running RuneAudio+R e2. I'm going to try to describe what I did.

It uses the installed bluez and bluez-alsa. First, you have to activate Bluetooth in the Runeaudio menu.
After that create the following file as /etc/systemd/system/bluealsa.service

Code: Select all
[Unit]
Description=BluezAlsa proxy
Requires=bluetooth.service
After=bluetooth.service

[Service]
Type=simple
ExecStart=/usr/bin/bluealsa -p a2dp-sink --a2dp-volume

[Install]
WantedBy=multi-user.target

This is a drop in replacement for the provided system service file. The only difference is that it runs bluealsa with the option
Code: Select all
-p a2dp-sink
to let the Raspberry Pi act as a high definition audio sink. The option
Code: Select all
--a2dp-volume
let's you adjust the volume via the volume keys on your phone.

Now, start and enable the bluealsa.service (the first command is only required if you didn't reboot first)
Code: Select all
systemctl daemon-reload
systemctl start bluealsa.service
systemctl enable bluealsa.service


Then I created a new Service file under /etc/systemd/system/ named a2dp-playback.service with the content
Code: Select all
    [Unit]
    Description=A2DP Playback
    After=bluealsa.service syslog.service
    Requires=bluealsa.service

    [Service]
    ExecStartPre=/bin/sleep 3
    ExecStart=/usr/bin/bluealsa-aplay --profile-a2dp 00:00:00:00:00:00
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=A2DP-Playback
    User=root

    [Install]
    WantedBy=multi-user.target


You then have to start and enable this service (the first command is only required if you didn't reboot first)
Code: Select all
systemctl daemon-reload
systemctl start a2dp-playback.service
systemctl enable a2dp-playback.service


I suggest that you reboot now that all services are loaded in the right order.
At this point the Raspberry Pi should appear in the list of bluetooth devices on your phone. Now you can pair your smartphone... This is still a bit tricky and still requires ssh access and an open console running bluetoothctl. So, open a terminal and run bluetoothctl on the Pi. Try to pair with the Pi from your phone. Your phone and bluetoothctl should display requests for confirmation of PINs. After that bluetoothctl needs requests authorization to connect your phone to the bluetooth service. After that the Pi should be configured as a bluetooth audio sink and you can start playing audio on your phone. Just make sure that the Pi is not playing via MPD or other sources at the same time: alsa allows only access by one process.

Finally, add your phone to the list of trusted devices in bluetoothctl
Code: Select all
trust <mac address of your phone>

This avoids the asking for authorization in the future and requires no further user interaction in bluetoothctl when reconnecting your phone later on.

One final remark. I changed the file /srv/http/settings/system-bluetooth.sh to
Code: Select all
#!/bin/bash

bluetoothctl system-alias "$( cat /srv/http/data/system/hostname )"
bluetoothctl agent NoInputNoOutput
bluetoothctl default-agent
bluetoothctl pairable on
sleep 1
bluetoothctl discoverable on
bluetoothctl discoverable-timeout 0


This enables automatic pairing (without PIN) but still requires to trust the device via bluetoothctl in a terminal. I didn't find a way to give this authorization without user interaction but I don't think that its a good idea from the security perspective anyway. I think, it would be nice to get the autorization request in the Runeaudio interface (with the option to trust the device for future use) as a popup or so or to be able to (pair and) trust devices in the settings menu.

I hope this helps somebody :) And,... suggestions and help are appreciated!

Best
kailua
 
Posts: 6
Joined: 27 Feb 2020, 19:29

Re: BlueTooth

Postby mangocats » 22 Mar 2020, 15:33

So, I realize this is an old thread... I've been using a Pi Zero W with LibreElec to play music playlists, as well as 1080p video, via Bluetooth speakers for some time. I'm looking for a better music player interface, and I hope Rune is it. I'd also like to put a Pi Zero W in my car and feed audio to the in-dash receiver via Bluetooth - not the most ideal audio quality, but far better than FM.

What's the status of Bluetooth audio out support in Rune?
mangocats
 
Posts: 1
Joined: 22 Mar 2020, 15:27

Re: BlueTooth

Postby Hellgier » 12 Apr 2020, 14:58

kailua wrote:Hello,

I know, time has passed and I don't know if this is still an issue in Runeaudio (I am using RuneAudio+R e2), but, I found a very easy solution to get a2dp bluetooth audio from your phone to a Raspberry Pi 3 running RuneAudio+R e2. I'm going to try to describe what I did.
....



As for me this is incredibly relevant - Im still running 0.4 as it is fast to boot and I just like it. Tried your recipe yet I got to "bluetoothctl: error while loading shared libraries: libreadline.so.8: cannot open shared object file: No such file or directory"

But that's not the point. Point is that with bluetooth Rune would be just perfection - I have guests quite often and that would be cool if they can stream whatever they want - for now its my laptop + swyh. Meh.
I even got bluetooth dongle but have no clue how to connect it to Rune. And yeah, I do not understand why there is no bluetooth. It exists on Volumio, there are lots of images for RPI that has it - but not Rune. I've heard about "its linux, its complicated" yet...

Rune is really awesome but I kinda have to add "... for old-school audio payback".
Pity though. Pity...
Hellgier
 
Posts: 2
Joined: 21 Dec 2019, 00:31

support RuneAudio Donate with PayPal

Previous

Return to Feature request

Who is online

Users browsing this forum: No registered users and 0 guests