Pi Zero & Hifiberry DAC (bluetooth delay issue)

Hi
Fist post! :slight_smile:

I’ve messed around with my Zero and Balena for a couple of days now. (The getting started documentation should be looked over and simplified)
Finally thanks to numerous tweaks and reimagings got everything to work. (Note: Spotify will stutter if you set it to 320bit)
One final issue that I have is with Bluetooth. There’s a near 4second delay between my phone and Pi. Watching videos is eerie to say the least.
Could you help me troubleshoot the issue?
Also SOUND_DISABLE_PLUGIN SOUND_DISABLE_AIRPLAY doesn’t seem to work and I’ve noticed that when I power on the device there’s a near 5minute window before I can use it. All services boot up and for some reason Audio service is the last one to come online. Other services keep looping (starting and exiting) until Audio comes up.

PS! Figured out why SOUND_DISABLE_PLUGIN didn’t work.
The env var has to be SOUND_DISABLE_AIRPLAY with a random value.
(writing for anyone that misunderstood the instructions just as I did…)

Hey there

Welcome to the forums and thanks for trying balenaSound and providing the feedback.

The getting started documentation should be looked over and simplified

Can you please clarify which parts were confusing for you? Also can you please elaborate on which “numerous tweaks” you had to do to get htings going?

Did you deploy the balenaSound app using the One-click deploy method or using the balenaCLI? I noticed you chimed in on the other thread related to builds that keep running. We noticed an issue on our backend servers and this should be resolved.

I’ve also created an issue for documenting how to disable plugins better. (Clarify SOUND_DISABLE_PLUGIN is not an env var to be set but a pattern · Issue #445 · balenalabs/balena-sound · GitHub)

As for your issue with Bluetooth and startup delays, I am suspecting this may be related to the pi zero being resource constrained.

  • Can you please confirm what sd card you are using?
  • Do you need the multi-room feature with balenaSound? if not, perhaps you can try to disable it by creating another environment variable SOUND_MODE with value STANDALONE and see if it helps?

Let us know if this helps
Cheers

Hi Rahul

Thanks for the reply. I miss typed. The Getting started documentation is filled with info but as a new user (even though I have 10+ years in the IT field) I failed to comprehend on how to first get started.
I was going purely by the onscreen promts and not the documentation.
I didn’t find the “getting started” documentation until later.

  1. I failed to understand what exactly an “application” is
  2. I failed to understand that I was supposed to image the device and boot it up before I could add plugins.
  3. Had trouble differentiating between “Development” and “Production” images.
  4. I failed to understand how “adding releases” works.
    4.1 The firsttime instructions just say that you should add them via BalenaCLI .
    4.2 No instuctions on what to exactly do with it or commands. I spent quite a while just experimenting and google-ing.
    4.3 Also had trouble finding BalenaSound. Ended up following this manual >>LINK<< which is already a bit outdated.
    It also expects that people are familiar with GitHub and downloading and pushing packages from there (which I was not)
    4.4 Would be much easier for new users to redirect them to a website that has these buttons for different usecases.
    image
    and then hinting to “advanced users” that they can also visit balenaLabs · GitHub if they’re feeling lucky and want to experiment with diferent branches.
  5. BalenaCLI also doesn’t show up in the Start menu.
    Took some time for me to figure out that the installer just added a whole new set of commands to use.

Slight side note: As I mentioned my previous IT background I also tried to ease my life a bit with adding BalenaCLI as a “profile” to >>Windows Terminal<< but BalenaCLI installation doesn’t generate a GUID. Typing “balena” everytime to every command seemed a bit tedious.

Coming back to my tweaks that I tried. I’ve tried several going off of various GitHub pull requests, balena forum posts etc. Some even “bricked” my OS so I had to remove them or reimage it but I don’t even remember what they were :smiley:

Anyway this is my current set of added commands:

AUDIO_OUTPUT DAC

BLUETOOTH_DEVICE_NAME k6lar

SOUND_DEVICE_NAME k6lar

SOUND_DISABLE_AIRPLAY 1

SOUND_MODE STANDALONE

SOUND_SPOTIFY_BITRATE 160

SOUND_SPOTIFY_PASSWORD not gonna share :slight_smile:

SOUND_SPOTIFY_USERNAME not gonna share :slight_smile:

Alongwith

Disabling VPN Connectivity check

Disabling VPN

Disabling Rainow splash screen

Default DT parameters

DT overlay as hifiberry-dac

Disabling UART

Local mode is not enabled atm. and the SD card I’m using is the 16GB SanDisk Edge that came with the Pi Zero.

Just an idea but is it possible to create a boot order for the plugins?
Start supervisor and audio first… wait a couple of seconds and then the rest of the plugins?
Also why isn’t SOUND_DISABLE_AIRPLAY removing the plugin from the bootsequence entirely? Going by the log AIRPLAY currently spends about 46 seconds trying to boot up before it realizes that it should be disabled and exits.
If we’re talking about possible resource constraints then these last two points should probably be a priority…

Hello there, thank you for your suggestions! We are currently working on a revamp to our documentation site, improving visibility on this topics is definitely high up on our list, we’ll take all your points into consideration for sure.

Regarding your original request for troubleshooting help with the delay, the amount of delay you are experiencing is to be expected, this is due to the software stack we are using. balenaSound is not suitable for streaming audio from video sources (unless you are OK with audio/video been out of sync, which most of the times is not the case). Removing services that you wont be using might help improve the delay, as you found out the env vars SOUND_DISABLE_xxx only disable the services. They can be entirely removed so that they don’t even start up but that requires editing docker-compose.yml file and deploying via the balena CLI. Many users aren’t tech savvy enough to do this, so that’s why we provided the env var route. If you are up to it you can edit the file and remove any service you don’t want, from what I gathered in this thread you can remove all but audio, sound-supervisor and whatever plugin you desire. (btw, this is not documented currently but will be soon).