TCH
-
Posts
8 -
Joined
-
Last visited
Reputation Activity
-
TCH reacted to guidol in BlueALSA: Bluetooth-Audio using ALSA (not PulseAudio)
@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:
So - this should help you and me and anyone who will try BlueALSA in the (near) future
-
TCH reacted to guidol in BlueALSA: Bluetooth-Audio using ALSA (not PulseAudio)
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
MP3_FFH80s
-
TCH reacted to guidol in BlueALSA: Bluetooth-Audio using ALSA (not PulseAudio)
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:
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:
-
TCH got a reaction from guidol in BlueALSA: Bluetooth-Audio using ALSA (not PulseAudio)
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?
-
TCH got a reaction from guidol in BlueALSA: Bluetooth-Audio using ALSA (not PulseAudio)
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. :) )