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: