Jump to content

BlueALSA: Bluetooth-Audio using ALSA (not PulseAudio)


Recommended Posts

Posted

Yesterday I did get a new little Bluetooth-Speaker, but without AUX - I rechecked some Bluetooth-Commands.

But could never connect,  because the Pi missed the protocol A2DP - which was only available with PulseAudio as Bluetooth-Module :(

 

So I used my 2nd OrangePi One with USB-Bluetooth-Dongle and mainline-kernel for this challenge:
ARMBIAN 5.38 stable Debian GNU/Linux 9 (stretch) 4.14.18-sunxi

Linux opi-one-main 4.14.18-sunxi #24 SMP Fri Feb 9 16:24:32 CET 2018 armv7l GNU/Linux


I like ALSA more than PulseAudio - I searched for ALSA and Bluetooth-Audio - and did found no good news about Audio and Bluetooth while using ALSA.
At the second search I did found the Project

BlueALSA (formerly know as BluezALSA) :  https://github.com/Arkq/bluez-alsa

 

While BlueALSA isnt available as .deb-package (and if then only on the RPi) I did use the following sites for documentation:

 

As Dependencies I had to install the following packages:
apt-get install libasound2-dev dh-autoreconf libortp-dev bluez bluetooth bluez-tools libbluetooth-dev libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libsbc1 libsbc-dev libfdk-aac-dev

 

libfdk-aac-dev is one more than at the RPi-Documetation page.

 

For creating / compiling BlueALSA I did use the follwoing commands:
cd /home/guido
git clone https://github.com/Arkq/bluez-alsa.git
cd bluez-alsa/
autoreconf --install
mkdir build && cd build
../configure --disable-hcitop --with-alsaplugindir=/usr/lib/arm-linux-gnueabihf/alsa-lib
make && sudo make install

 

When BlueALSA has been created, then you can start BlueALSA as background task:
bluealsa --disable-hfp &

 

Now - for using your bluetooth-speaker/headset - with BlueALSA you have to intoduce the device to the bluetooth-stack using bluetoothctl:
bluetoothctl >
scan on
[NEW] Device 30:23:23:F4:48:2C TH-S10U
scan off
pair 30:23:23:F4:48:2C
trust 30:23:23:F4:48:2C
exit

 

After that power off&on the bt-speaker device and the device will connect automatically as a trusted device.

 

Before we try our first audio-command we had to export one thing to make BlueALSA mor system-friendly:
export LIBASOUND_THREAD_SAFE=0because of a message while compiling:

Spoiler

 

configure: WARNING:               *** alsa-lib >= 1.1.2 ***
configure: WARNING: Starting from alsa-lib 1.1.2, it is possible to enable
configure: WARNING: thread-safe API functions. Unfortunately, this feature
configure: WARNING: is not mature enough - software plugins may experience
configure: WARNING: random deadlocks (bluez-alsa PCM plugin is affected).
configure: WARNING: Either compile alsa-lib without this feature or export
configure: WARNING: LIBASOUND_THREAD_SAFE=0 while using bluealsa PCM.

 

 

Now you can try your first commands for getting audio out of the device:

 

Text to speech:

espeak "Hello, how are you?" -w /home/guido/espeak.wav -s145
aplay -D bluealsa:HCI=hci0,DEV=30:23:23:F4:48:2C,PROFILE=a2dp /home/guido/espeak.wav

 

Internetradio:

mpg123 -a bluealsa:HCI=hci0,DEV=30:23:23:F4:48:2C,PROFILE=a2dp -@ /home/guido/ffh80s.pls

 

For shorting the command you could create a ~/.asoundrc with the following content:

defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "30:23:23:F4:48:2C"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000

 

Now you can the shorter version of the command:

mpg123 -a bluealsa -@ /home/guido/ffh80s.pls

 

For set the volume of such a device you have to know the "real" name of the device out of the bluetoothctl and the name of the used protocol:

Device: 30:23:23:F4:48:2C TH-S10U
Protocol: A2DP
amixer -D bluealsa sset 'TH-S10U - A2DP ' 70%

 

Here as information the dmesg-part of my bluetooth-dongle:

Spoiler

[346859.531251] usb 4-1: new full-speed USB device number 2 using ohci-platform
[346859.807299] usb 4-1: New USB device found, idVendor=0a12, idProduct=0001
[346859.807317] usb 4-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[346859.807329] usb 4-1: Product: CSR8510 A10
[346859.963820] Bluetooth: Core ver 2.22
[346859.963906] NET: Registered protocol family 31
[346859.963910] Bluetooth: HCI device and connection manager initialized
[346859.963928] Bluetooth: HCI socket layer initialized
[346859.963938] Bluetooth: L2CAP socket layer initialized
[346859.963965] Bluetooth: SCO socket layer initialized
[346859.975588] usbcore: registered new interface driver btusb
[346860.184710] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[346860.184718] Bluetooth: BNEP filters: protocol multicast
[346860.184734] Bluetooth: BNEP socket layer initialized
[346901.432957] Bluetooth: RFCOMM TTY layer initialized
[346901.432979] Bluetooth: RFCOMM socket layer initialized
[346901.432998] Bluetooth: RFCOMM ver 1.11
[347059.966606] input: 30:23:23:F4:48:2C as /devices/virtual/input/input1

 

Posted

Hi Guido.

I have been searching for a way to play audio on my blue tooth speaker for ages and was really excited when I saw your post.

I compiled it according to your instructions and I can see and pair my speaker.But when I try to play a file I get this error

Spoiler

ALSA lib ../../../src/asound/bluealsa-pcm.c:679:(_snd_pcm_bluealsa_open) Couldn't get BlueALSA transport: No such device
aplay: main:722: audio open error: No such device

My device shows as a  ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

I am using the latest Armbian.

Do you have any suggestions for me?

Thanks.

J.

 

Posted
12 hours ago, Johhny Blue said:

But when I try to play a file I get this error

  Hide contents

ALSA lib ../../../src/asound/bluealsa-pcm.c:679:(_snd_pcm_bluealsa_open) Couldn't get BlueALSA transport: No such device
aplay: main:722: audio open error: No such device

My device shows as a  ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

I am using the latest Armbian.

Do you have any suggestions for me?

First did you start blueALSA in the backgrund with bluealsa --disable-hfp &

Could you write the output of the command "devices" inside of bluetoothctl? (whats the name and id of your speaker?)

 

Did you pair & trust your BT-speaker inside of bluetoothctl?

Does BT-Speaker play the connect-sound and isnt blinking anymore?

 

ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) seems to be the address of your USB-BT(-Dongle)

 

Did you create a  ~/.asoundrc (in the homedirectoty of your user or root if you using root) with the default-definitons of bluealsa?:

defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "30:23:23:F4:48:2C"   <==== here the id of your BT-Speaker
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000

 

(the default will only apply to this one speaker which has this id - if you want to play on another speaker/device you had to add the parameters to the commandline of the audio-command)

 

If not you have to add the parameters for id and profile to the commandline.

 

I have tested it today with 2 additional speakers, and the connect didnt work directly, but after starting bluealsa and then a moment later

the BT-speaker will auto-connect if trusted:

Device 30:21:8E:AA:4C:45 ML-28U
Device 30:23:23:F4:48:2C TH-S10U
Device 00:11:67:3F:9B:18 BTLS9001

 

If you didnt want to auto-connect or it wouldnt autoconnect you can connect to a paired&trusted BT-Speaker with the command:
echo -e "connect 00:11:67:3F:9B:18\nquit" | bluetoothctl     <=== here you also need to change the id to the id of your BT-Speaker

 

Disconnect is the same:

echo -e "disconnect 00:11:67:3F:9B:18\nquit" | bluetoothctl

 

You could also change the commandline here for pairing or trusting a device like

echo -e "pair 00:11:67:3F:9B:18\trust 00:11:67:3F:9B:18\nquit" | bluetoothctl

 

Which command did you use to play a sound? (please copy the full command line)

Posted

Hi Guidol:

 

Great post. For me everything worked great, nevertheless i can not find the way to auto connect my bluetooth speaker even as the trust command finished successfully with the bluetoothctl.

 

Any ideas?

 

Thanks, Mauricio F.

Posted
16 minutes ago, mflorezm said:

Great post. For me everything worked great, nevertheless i can not find the way to auto connect my bluetooth speaker even as the trust command finished successfully with the bluetoothctl.

Any ideas?

 

Normally your speaker should auto-connect (after areboot) when the speaker is paired & trusted before via bluetoothctl

Or you can try it without trust and do a connect via commandline (see above) at startup (e.g. /etc/rc.local)

Posted

Hi guidol:

 

Your suggestion did not work (adding to /etc/rc.local). And again it did not auto connect even it is already trusted.

 

Fortunately, i found a solution adding a cron job to connect

 

sudo crontab -e

@reboot sleep 5 && /bin/echo -e 'connect 00:58:56:7A:9F:0D \n quit \n' | bluetoothctl

 

Regards,

 

Mauricio F.

Posted

..so another talking with myself .. :D

 

Here is some scripts to automate pairing and playing,

if you can use Opi as Bluetooth speaker.


script for automated pairing ...

Quote

/lib/systemd/system/bluetooth-bt-agent.service

[Unit]
Description=Bluetooth Simple Agent
Requires=bluetooth.service
After=bluetooth.service
[Service]
Type=simple
#User=root
#Group=audio
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput -p /etc/bluetooth/pin.file
[Install]
WantedBy=multi-user.target

 

we need to create PIN file list
 

Quote

/etc/bluetooth/pin.file

# accept pin 1234 for all devices

* 1234

# accept user pin for selected device

11:22:33:AA:BB:CC 0911

 

and run bluealsa & bluealsa-aplay as service on startup...

 

Quote

/lib/systemd/system/bluealsa.service

[Unit]
Description=BluezAlsa proxy
Requires=bluetooth.service bluetooth-bt-agent.service
After=bluetooth.service
[Service]
Type=simple
#User=root
#Group=audio
ExecStart=/usr/bin/bluealsa -S -p a2dp-sink -p hfp-hf -p hsp-hs
[Install]
WantedBy=multi-user.target

 

 

..and play some sounds..
 

Quote

/lib/systemd/system/bluealsa-aplay.service

[Unit]
Description=BlueAlsa-Aplay on ALL DEVICES
Requires=bluetooth.service bluetooth-bt-agent.service bluealsa.service
After=bluealsa.service
[Service]
Type=simple
#User=root
#Group=audio
ExecStart=/usr/bin/bluealsa-aplay 00:00:00:00:00:00
[Install]
WantedBy=multi-user.target

 

Posted

Hi Guido,

thank you for the tutorial. I ran into an issue on "make && sudo make install" step

 

Quote

$ make && sudo make install
make  all-recursive
make[1]: Entering directory '/opt/alsa_audio/bluealsa/bluez-alsa/build'
Making all in src
make[2]: Entering directory '/opt/alsa_audio/bluealsa/bluez-alsa/build/src'
Making all in asound
make[3]: Entering directory '/opt/alsa_audio/bluealsa/bluez-alsa/build/src/asound'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/opt/alsa_audio/bluealsa/bluez-alsa/build/src/asound'
make[3]: Entering directory '/opt/alsa_audio/bluealsa/bluez-alsa/build/src'
/bin/bash ../libtool  --tag=CC   --mode=link gcc /usr/lib/python3/dist-packages/blueman/bluez -pthread -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include  -g -O2   -o bluealsa shared/ffb.o shared/log.o shared/rt.o a2dp.o at.o ba-adapter.o ba-device.o ba-rfcomm.o ba-transport.o bluealsa.o bluealsa-dbus.o bluealsa-iface.o bluez.o bluez-a2dp.o bluez-iface.o hci.o sbc.o sco.o utils.o main.o    /usr/lib/python3/dist-packages/blueman/bluez -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lglib-2.0 -lsbc -lpthread -lm 
libtool: link: gcc /usr/lib/python3/dist-packages/blueman/bluez -pthread -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -o bluealsa shared/ffb.o shared/log.o shared/rt.o a2dp.o at.o ba-adapter.o ba-device.o ba-rfcomm.o ba-transport.o bluealsa.o bluealsa-dbus.o bluealsa-iface.o bluez.o bluez-a2dp.o bluez-iface.o hci.o sbc.o sco.o utils.o main.o /usr/lib/python3/dist-packages/blueman/bluez  -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lsbc -lpthread -lm -pthread
/usr/bin/ld: cannot find /usr/lib/python3/dist-packages/blueman/bluez: File format not recognized
/usr/bin/ld: cannot find /usr/lib/python3/dist-packages/blueman/bluez: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:562: recipe for target 'bluealsa' failed
make[3]: *** [bluealsa] Error 1
make[3]: Leaving directory '/opt/alsa_audio/bluealsa/bluez-alsa/build/src'
Makefile:655: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/opt/alsa_audio/bluealsa/bluez-alsa/build/src'
Makefile:436: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/opt/alsa_audio/bluealsa/bluez-alsa/build'
Makefile:368: recipe for target 'all' failed
make: *** [all] Error 2
 

 

The contents of the aforementioned directory are:

 

Quote

ls /usr/lib/python3/dist-packages/blueman/bluez/
Adapter.py         Device.py    Manager.py        PropertiesBlueZInterface.py
AgentManager.py    errors.py    Network.py        __pycache__
Agent.py           Headset.py   NetworkServer.py
BlueZInterface.py  __init__.py  obex
 

 Can you advise me on what I am doing wrong?

Posted
14 hours ago, Vaclav said:

Can you advise me on what I am doing wrong?

I can't see anything you did wrong - did all command before work find?

- install ALL dependencies

- autoreconf --install

 

Did you check the actual install commands on the git page https://github.com/Arkq/bluez-alsa ?:

Installation

$ autoreconf --install
$ mkdir build && cd build
$ ../configure --enable-aac --enable-ofono --enable-debug

make && make install

Maybe you have missing dependecies, that I already got on my system  - check the Dependencies on the github-page too...

Posted

Hello guidol,

 

Thank you for this great tutorial. I can confirm that this is works also on Devuan 2 (based on Debian 9). I only had to install one additional package: libdbus-1-dev.

The autoconnect did not worked, but manually connecting in /etc/rc.local did:

export LIBASOUND_THREAD_SAFE=0
bluealsa &
sleep 1 && /bin/echo -e 'connect 09:10:67:34:24:40\nquit\n' | bluetoothctl

However, even if i created ~/.asoundrc as you've suggested,

defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "09:10:67:34:24:40"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000

ALSA does not list the BT speaker. The system does recognize it, i hear it playing the connect/disconnect signals, but aplay cannot play through it. If i run

aplay -D bluealsa:HCI=hci0,DEV=09:10:67:34:24:40,PROFILE=a2dp fancy2.wav

The result is:

ALSA lib conf.c:4858:(parse_args) Unknown parameter HCI
ALSA lib conf.c:4991:(snd_config_expand) Parse arguments error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa:HCI=hci0,DEV=09:10:67:34:24:40,PROFILE=a2dp
aplay: main:788: audio open error: No such file or directory

aplay -L also does not list anything aside the RPi3's own devices. I know, that there is a known problem about RPi3 that it's WiFi conflicts with the BT dongle, but i use no WiFi, it's connected with ethernet cable. I've blocked blacklist modules brcmfmac and brcmutil and also disabled both WiFi and the onboard BT in /boot/config.txt, but to no avail.

 

Can you please advise me, what could i miss?

Posted

Okay, i tried it with bluealsa-aplay, but still no avail.

 

bluealsa-aplay -L

bluealsa:SRV=org.bluealsa,DEV=09:10:67:34:24:40,PROFILE=a2dp
    BT-SPEAKER, trusted audio-card, playback
    A2DP (SBC): S16_LE 2 channels 48000 Hz

bluealsa-aplay -D bluealsa:SRV=org.bluealsa,DEV=09:10:67:34:24:40,PROFILE=a2dp fancy2.wav

bluealsa-aplay: E: Couldn't parse BT addresses: Invalid argument

Same happens if i try to do it with an empty MAC address, or nothing.

 

If i do bluealsa-aplay -vv 09:10:67:34:24:40 the test song is begun playing but no sound.

 

I found this page: https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c

And installed a2dp-agent ran it manually, but still not works.

Posted
5 hours ago, TCH said:

bluealsa-aplay -D bluealsa:SRV=org.bluealsa,DEV=09:10:67:34:24:40,PROFILE=a2dp fancy2.wav


bluealsa-aplay: E: Couldn't parse BT addresses: Invalid argument

 

@TCH My first message in this thread is more than 2 years old and since I did try BlueALSA :)
Today I rechecked the instructions and did get the same errors while using HCI and DEV entrys in the commands aplay and mpg123.

 

I found out that we only have to set bluealsa as device and not the HCI and DEV config ;)
I also have now a working /etc/asound.conf for bluealsa.

 

OK - here now a not very formatted NEW instruction-set, which did work for me today ;)
 

Dependencies:
===================================================
apt-get install libasound2 libasound2-dev dh-autoreconf libortp-dev bluez bluez-tools libbluetooth-dev libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libsbc1 libsbc-dev bluetooth libfdk-aac-dev libdbus-1-dev


Installation:
===================================================
git clone https://github.com/Arkq/bluez-alsa.git

cd bluez-alsa/

autoreconf --install

mkdir build && cd build


../configure --enable-aac --enable-ofono
(without --enable-debug to get rid of the ebug messages while starting/conencting)
OR
For systems with aarch64-cpu-type (like the Allwinner H5 or A64 = 64bit):
-------------------------------------------------------------------------
../configure --enable-aac --enable-ofono --with-alsaplugindir=/usr/lib/aarch64-linux-gnu/alsa-lib
( /usr/lib/aarch64-linux-gnu/alsa-lib is generated while compiling )

make && make install


Starting BlueALSA 1st time:
===================================================
bluealsa --profile=a2dp-source --a2dp-force-audio-cd &

Pairing and trusting BT-device:
===================================================
bluetoothctl
scan on
[NEW] Device 00:11:67:3F:9B:18 BTLS9001
scan off
pair 00:11:67:3F:9B:18
trust 00:11:67:3F:9B:18
quit


REBOOT: (maybe)
===================================================
reboot


Starting BlueALSA 2nd time:
===================================================
export LIBASOUND_THREAD_SAFE=0
bluealsa --profile=a2dp-source --a2dp-force-audio-cd &


Connect truested speaker manually:
===================================================
echo -e "connect 00:11:67:3F:9B:18\nquit" | bluetoothctl


NEW syntax for aplay and mpg123 (without HCI and DEV):
===================================================
aplay -D bluealsa /home/guido/espeak.wav
mpg123 -v -a bluealsa -@ /home/guido/iradio/MP3_FFH80s

CREATING a BlueALSA /etc/asound.conf:
# =================================================
pcm.!default "bluealsa"
ctl.!default "bluealsa"
defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "00:11:67:3F:9B:18"
defaults.bluealsa.profile "a2dp"
# =================================================

Info about bluealsa:
===================================================
amixer -D bluealsa

Set the volume in alsamixer:
===================================================
alsamixer -D bluealsa


aplay and mpg123 AFTER creating a BlueALSA /etc/asounf.conf:
===================================================
aplay /home/guido/espeak.wav
mpg123 -v -@ /home/guido/iradio/MP3_FFH80s


Disconnecting the trusted/connected BT-device:
===================================================
echo -e "disconnect 00:11:67:3F:9B:18\nquit" | bluetoothctl 

and here the messages while compiling about the Libraries in /usr/lib/aarch64-linux-gnu/alsa-lib:
 

Spoiler

----------------------------------------------------------------------
 /usr/bin/mkdir -p '/usr/lib/aarch64-linux-gnu/alsa-lib'
 /bin/bash ../../libtool   --mode=install /usr/bin/install -c   libasound_module_pcm_bluealsa.la '/usr/lib/aarch64-linux-gnu/alsa-lib'
libtool: install: /usr/bin/install -c .libs/libasound_module_pcm_bluealsa.so /usr/lib/aarch64-linux-gnu/alsa-lib/libasound_module_pcm_bluealsa.so
libtool: install: /usr/bin/install -c .libs/libasound_module_pcm_bluealsa.lai /usr/lib/aarch64-linux-gnu/alsa-lib/libasound_module_pcm_bluealsa.la
libtool: install: /usr/bin/install -c .libs/libasound_module_pcm_bluealsa.a /usr/lib/aarch64-linux-gnu/alsa-lib/libasound_module_pcm_bluealsa.a
libtool: install: chmod 644 /usr/lib/aarch64-linux-gnu/alsa-lib/libasound_module_pcm_bluealsa.a
libtool: install: ranlib /usr/lib/aarch64-linux-gnu/alsa-lib/libasound_module_pcm_bluealsa.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sbin" ldconfig -n /usr/lib/aarch64-linux-gnu/alsa-lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/aarch64-linux-gnu/alsa-lib

 

 

So - this should help you and me and anyone who will try BlueALSA in the (near) future ;)

Posted

Oh, thank you for this detailed howto! I think i'll redo the entire setup with this as i already messed up the system a bit with experimenting.

 

A theoretical question (as i has no means to try it out) what if i will attach multiple BT speakers to the system, how i'm gonna controll them via aplay? Do i need to add a separate pcm for each of them in asound.conf?

Posted
58 minutes ago, TCH said:

A theoretical question (as i has no means to try it out) what if i will attach multiple BT speakers to the system, how i'm gonna controll them via aplay? Do i need to add a separate pcm for each of them in asound.conf?

I did short test and the problem with the BT-address parse seems to occur only with bluealsa-aplay :)

bluealsa-aplay: E: Couldn't parse BT addresses: Invalid argument


I paired/truted a second BT-speaker with bluetoothctl and now I can adress a different speaker with:
 

aplay -D bluealsa:DEV=00:11:67:3F:9B:18 ./espeak.wav
aplay -D bluealsa:DEV=78:44:05:00:69:9A ./espeak.wav
OR
mpg123 -v -b1024 -a bluealsa:DEV=00:11:67:3F:9B:18 -@ /home/guido/iradio/MP3_FFH80s
mpg123 -v -b1024 -a bluealsa:DEV=78:44:05:00:69:9A -@ /home/guido/iradio/MP3_FFH80s

My Bluetooth-USB-Transceiver connected to the NanoPi A64:
---------------------------------------------------------
root@npi-a64-116(192.168.6.116):~# lsusb
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

root@npi-a64-116(192.168.6.116):~# dmesg |grep -i blue
[    7.341576] Bluetooth: Core ver 2.22
[    7.341667] Bluetooth: HCI device and connection manager initialized
[    7.341685] Bluetooth: HCI socket layer initialized
[    7.341691] Bluetooth: L2CAP socket layer initialized
[    7.341706] Bluetooth: SCO socket layer initialized
[   17.611736] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   17.611746] Bluetooth: BNEP filters: protocol multicast
[   17.611769] Bluetooth: BNEP socket layer initialized

As I did see Bluetooth Ethernet I blacklisted it :)
nano /etc/modprobe.d/blacklist.conf --> insert the lines and reboot:
# blacklist bluetooth ethernet bnep
blacklist bnep

BlueALSA_htop.thumb.jpg.6281df7afb5ab62c9e6e15a221c480d3.jpg

 

 

MP3_FFH80s

Posted

I see, so it's not necessary to have multiple PCM entries, i can select with MAC address. Thank you again! (For the '80s radio link too. :) )

Posted

When i play a wav with aplay, then the first ~1 second of it is being cut. I've checked what could it be and the only things i've found were the wifi (which did not caused this as disabling it did nothing) and the A2DP trigger delay. How can i disable the A2DP trigger delay?

Posted

Hi Guido,

thanks for your shared infor regarding Bluealsa.

I have a application that manage the followings ALSA output:

  • plughw:0,0 bcm2835 ALSA is the Raspberry Pi output to the audio connector.

  • plughw:0,1 bcm2835 ALSA is the Raspberry Pi output to the HDMI interface

  • plughw:1.0 USB Audio CODEC is a USB connected audio device.

I would like to connect these available fixed sources to the built in Raspberry pi  Hci0.

Can you please let me know how i can bridge one of these sources with blueAlsa ?

Thanks

Luca

Posted
12 hours ago, LucaF said:

I would like to connect these available fixed sources to the built in Raspberry pi  Hci0.

Can you please let me know how i can bridge one of these sources with blueAlsa ?

I think you cant "bridge" them. You cant only (when paired & trusted a device) you a specific /etc/asound.conf

to make your BlueALSA-device as default:
 

CREATING a BlueALSA /etc/asound.conf:
# =================================================
pcm.!default "bluealsa"
ctl.!default "bluealsa"
defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "00:11:67:3F:9B:18"
defaults.bluealsa.profile "a2dp"
# =================================================

 

Posted
On 6/23/2020 at 3:26 PM, TCH said:

When i play a wav with aplay, then the first ~1 second of it is being cut. I've checked what could it be and the only things i've found were the wifi (which did not caused this as disabling it did nothing) and the A2DP trigger delay. How can i disable the A2DP trigger delay?

Hello everybody, 

Thanks for so much information. :)
I'm also making a code using espeak and bluetooth devices using a Raspberry Pi Zero W for an art project.  I've been struggling with two issues that I would like to share. in case some of you know how to fix it.  

Thanks in advice :)

1- When using the JBL speaker the connection and sound works fine, but I have the -1 second being cut.  Did you manage to fix it? 
2- When paring bluetooth headphones, .wav files sometimes get cut, and on he other hand,  when using espeak I just listen to 1 second of audio. 
First I thought it was a battery issue, but I tested the headphones by pairing them with my computer and they work fine. The problem appears when using them with the Raspberry.-Pi. Is there any special configuration for headphones that I'm missing?


Anyway, if you have some information about this I would appreciate if you could share it with me. 
Cheers!

Posted

Hey, thank you for a great writeup!

 

One question, MPD related - if you set mixer_type to software, you end up with three volume levels - one ALSA, one MPD and one for the headset. Any way to "sync" these?

Posted (edited)

Hello, has anyone managed to eliminate the audio lag? How do I make this beginning of a wav file audible? Even if I put 1 second of silence in the wav file, it doesn't help.

Can you wake up the speaker by some command before playing the audio file?

Edited by aniol

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines