site  contact  subhomenews

Audiosonic E920 speaker working with EasyOS 2.2

January 06, 2020 — BarryK

I posted recently about ordering bluetooth goodies from eBay:

https://bkhome.org/news/202001/goodies-ordered-for-bluetooth-debugging.html

However, I do already own a bluetooth loudspeaker, an Audiosonic brand, model E920, purchased from Kmart about 4 years ago. I don't recall what I paid, and it is no longer sold, however this chap bought one from Kmart in 2016 and paid AU$15:

https://www.youtube.com/watch?v=H2BiMlbJ6TY

I used it for awhile with my phone, but was underwhelmed by the audio quality, and resorted to ear pieces with wired 3.5mm plug.

Anyway, dug it out for testing on my laptop, running EasyOS Buster 2.2.

There is a fundamental problem however, bluez v5, the Linux bluetooth package, does not work with alsa, requires pulseaudio. There is 'apulse' installed, which is a substitute for pulseaudio and enables applications compiled to need pulseaudio, to play with alsa. Firefox for example. But apulse does not work with bluez.

However, there is a package, 'bluez-alsa', that may be described roughly as "the apulse for bluetooth". There is no DEB, had to compile it. Here are my notes:

https://github.com/Arkq/bluez-alsa/releases
https://forum.armbian.com/topic/6480-bluealsa-bluetooth-audio-using-alsa-not-pulseaudio/

bluealsa required deps:
sbc libsbc already installed
fdk-aac installed with petget, from multimedia repo
libortp13 and deps, installed with petget

also installed:
bluez-tools
bluez-obexd

bluez-alsa 2.0.0
# autoreconf --install
# mkdir build
# cd build
# ../configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu --enable-aac --enable-mp3lame --enable-mpg123 --with-alsaplugindir=/usr/lib/x86_64-linux-gnu/alsa-lib --enable-rfcomm --enable-ofono --enable-hcitop
# make
# new2dir make install

note, may need "LIBASOUND_THREAD_SAFE=0" when using bluealsa.
# export LIBASOUND_THREAD_SAFE=0

need to run bluealsa as a background task:
# bluealsa &
used blueman to pair loudpseaker "BS512"
# aplay -D bluealsa:SRV=org.bluealsa,DEV=29:F0:F0:54:C2:7B,PROFILE=a2dp /usr/share/audio/2barks.au
...works!

Recommend do this, /root/.asoundrc:
defaults.bluealsa.service "org.bluealsa"
defaults.bluealsa.device "29:F0:F0:54:C2:7B"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000

then this works:
# aplay -D bluealsa /usr/share/audio/2barks.au

to set bluealsa as default device:
https://www.raspberrypi.org/forums/viewtopic.php?t=247334
in /root/.asoundrc:
pcm.btreceiver {
type plug
slave.pcm {
type bluealsa
device "29:F0:F0:54:C2:7B"
profile "a2dp"
}
hint {
show on
description "Bluetooth Receiver"
}
}

pcm.!default {
type plug
slave.pcm "btreceiver"
}
# aplay /usr/share/audio/2barks.au
Playing Sparc Audio '/usr/share/audio/2barks.au' : Mu-Law, Rate 8000 Hz, Mono
...works!

Actually, I created /root/.asoundrc with both of those above suggestions in it.

I did of course use the 'blueman' tray applet to pair with the bluetooth loudspeaker, and also activated it as an "audio sink".

I now need to integrate this into Easy Buster. The 'bluealsa' daemon will need to be started at bootup, and note that 'hci0' must exist before starting it. Then, if pair with an audio device, need to somehow automate the creation of /root/.asoundrc  

One extra note: I played '2barks.au' and it plays slightly truncated, as far as I can make out, from the beginning. Is that going to be a problem? 

Tags: easy