Attemting to install Bluez-alsa on Vero4k+

I’ll have a look when I get time. My development vero is in the sick bay atm.

OK buddy, bump the thread if you discover anything.

Out of interest, is it possible that the Vero is running stretch, and the pi4 running Buster likely to be the issue?
I noticed that the ALSA driver on the Vero is Version k3.14.29-156-osmc, while on the Pi4 its Version k4.19.88-v7l+**

I wouldn’t have thought so.

The devices do have different ALSA implementations, but our A2DP package works, so I’m not sure that this is the problem.

Ah OK cheers Sam

I’m going to take another look at BlueZ-ALSA as it seems to have developed a lot since we last looked at it.

Sam

Good stuff.
Out of interest I presume that including the codecs (aptx,aptx-hd,ldac) in OSMC as standard is out of the question due to licensing ?

Happy new year BTW!

Something that I need to look in to…

You too!

Not sure if this information is useful or not:
Thought I’d see if bluealsa works on a Pi3 running the latest OSMC, and the behaviour is identical to the Vero4K+

The error:

ERROR: ActiveAE::InitSink - failed to init

appears in the log directly after opening the bluetooth audio device…and obviously no audio through bluetooth.
In fact there’s no audio whatsoever after that, you have to select another audio device then reboot to get audio back…which is the same as the Vero.

That will be a problem.

Try pairing, then go to Exit Kodi and wait for it to come back up…

Sam

Then it just hangs indefinitely Sam…only way I’ve found to regain audio is to select a different device then either restart the mediacenter service, or just a reboot.

It’s no big deal mate, just pointing out that the behaviour of bluealsa is identical on the Pi3 as it is on the Vero4k+.

I appreciate that you guys will be busy for the foreseeable with the new kernel etc, I’ve found a workaround which is pretty simple to implement and achieves my goal of streaming from Vero4k+ to bluetooth using the better quality codecs now available in bluealsa.

Long story short:

Install bluealsa and codecs (ldac, aptx, aptx-hd, aac) as per the GitHub instructions.
Enable the snd-aloop module in /etc/modules.
Enable loopback device to show up in kodi via .asoundrc.

To Use:
Connect bluetooth device via bluetoothctl.
Select loopout device in kodi audio settings.
pipe loopout from arecord into aplay using bluealsa as the audio output device:

/usr/bin/arecord -f dat --buffer-size 512 -D loopout | /usr/bin/aplay --buffer-size 512 -D bluealsa

I know its a bit hacky but its working pretty good for me so far, it does delay the audio by approx 0.25 seconds, but the quality is great…really noticeable.
Hopefully one of you smarter folks can work out what the underlying issue is at some point so this approach won’t be needed.

Heh, that’s a pretty smart workaround.

It works surprisingly well Sam.

I wrote a really simple add-on a while back to automatically connect/disconnect my bluetooth headphones on my Pi4, and switch the audio output via json… as bluealsa seems to work fine with Kodi on the Pi4 thats all thats needed to get BT streaming working.
I just copied that add-on onto my Vero and added a line to launch or kill the arecord/aplay command.

I mapped a button on my remote to launch the add-on so the entire process to start/stop BT streaming can be done with a couple of button presses.

As I said, in an ideal world it’ll only be a short-lived workaround, I understand that you guys have a lot on right now, but its doing a fine job in the meantime.

1 Like

@sam_nazarko
Hi Sam slight issue, due to the fact im very slightly deaf in one ear I have to adjust the audio balance on every device I use headphones on…not really an issue as I this is normally very simple to do.

When using my BT headphones on the vero, this is achieved by using alsamixer, selecting the bluealsa device, adjusting the balance (100 left, 97 right)…bingo, correct balance is achieved.

The only problem is saving this so I dont have to make this adjustment every time I use my headphones, from what ive read it should be a matter of simply:

sudo alsactl store

but it just hangs, I can’t exit from the terminal then, and even rebooting the vero from a different terminal causes the shutdown process to hang indefinitely…leaving no option but to unplug it which I know it’s not wise to do.

Any ideas here mate? Would some logs help.

It should be possible to set the volume for each channel in 20-bluealsa.conf or .asoundrc.

FWIW, I have BT audio working both ways with bluealsa and bluealsa-aplay now without using a pipe. Needs some work to auto-connect though. Can you share your add-on?

All my attempts at piping audio gave me horrible latency (like 2 seconds) but eventually I managed to get bluealsa to show up in Kodi settings so kodi can send audio to it direct.

I’ve uploaded the add-on here mate:
http://s000.tinyupload.com/index.php?file_id=78254322246055462408

You’ll have to change the BT mac address in hp_on.py as its hardcoded, ideally this should be configurable in the settings but I never got round to it.

TBH im interested what you want it for as the main purpose was just to start the audio pipe, the only other function is to connect the device via bluetoothctl, and switch the kodi audio device.

In the add-on, enabling obviously connects the BT device via bluetoothctl, starts the pipe, and switches the kodi audio output device.
Disabling stops the pipe, disconnects the BT device, and switched the kodi output to HDMI.

To say its unsophisticated is an understatement.

Its very promising that you’ve got it working without the use of a pipe Graham, did it take much work? Was it just a question of a specific .asoundrc configuration?

Ill have a look at configuring my .asoundrc file to incorporate the balance adjustment I need, I had a quick look earlier but thought it should be possible with just saving the settings via:

sudo alsactl store

Currently ALSA will hang if trying to save parameters due to the implementation of the driver being somewhat incomplete. Could you try our 4.9 build again at some point and see if it’s still a problem there?

Sam

As soon as the 1080i/Live TV issue is sorted I’ll test it Sam.

We are going to spin a new build with quite a few changes.