command latency using airplay

Hi ,

my multi-room fleet has two boards

the “master” node is connected using ethernet
Raspberry Pi 3B (using 64bit OS), host os version balenaOS 2.65.0+rev1 , supervisor version 12.5.6

the “slave” node is using WIFI
Raspberry Pi 3 , host os version balenaOS 2.72.0+rev1, supervisor version 12.5.6

I see extremely long latency in airplay commands , The sound and synchronisation is just fine but any commands (play/pause/next etc…) take sometimes ages to complete : between 5 to 10 seconds

sometimes , it so long to complete that I end up piling commands and everything start acting like crazy.

Any help to troubleshoot this would be welcome.
Regards
EJ

Hi there,

We have a good description of why this happens in the “Audio is delayed” section of our troubleshooting docs:

balenaSound uses many technologies to provide audio streaming capabilities. All these layers of software introduce a small amount of delay that in the end add up to something that can be noticeable. We understand that this means that balenaSound is not suitable for certain applications (streaming audio from video sources for instance) but we believe this is an acceptable tradeoff for all the cool features we offer.

also

Airplay streaming has a built-in two-second delay. Using a different audio source will obviously yield better results.

If you need multiroom and airplay, the delay is not something we can solve.

Phil

Hi,
First of all thank a lot for this quick answer.

About streaming on bluetooth , I do not see the link with using a bluetooth dongle as it happen also
on my other board which is connected using the ethernet plug.

About the airplay delay, I saw the posts on the forum but they mention 2/3 seconds of delay. In my case it is sometimes more about 5/10. I 'll make some clearer measurement.

Any logs I can activate to have a more clear view of what going on ?

thank
regards

Hello,

You can enable persistent logging on the device, which will help in debugging as otherwise logs will get wiped on reboot: What is balenaOS? - Balena Documentation

In terms of additional logging, you can use journalctl to look at logs about system services, which could reveal networking on service issues causing potential latency: Beginners Guide to “journalctl” – How To Use Journalctl to View and Manipulate Systemd Logs – The Geek Diary
I would suggest trying journalctl -u NetworkManager.service to check for networking issues specifically to see if the device is struggling with connection.

You can also check dmesg as well: https://www.howtoforge.com/linux-dmesg-command/

Hi,
thank you will try to get logs for the bluetooth issue. By the way I’ve checked
what described here [RPi3 rev below 1.3] Occasional data loss when using bluetooth · Issue #476 · balena-os/balena-raspberrypi · GitHub

on my system the baudrate is already the “right” one.

regards

@ejannett, what software are you using to stream via AirPlay?

Regarding latency, as stated above the base latency for AirPlay is 2/3 seconds and you need to add the multiroom latency to that. Multiroom latency starts at about 250msec but can easily shoot up to 10 secs if one of the devices on the fleet has a shaky network connection. What I think is happening is that Airplay commands are being processed with “normal” latency of a couple seconds, but you only notice the result of it a long while after because your multiroom latency is quite large.

So a few suggestions:

  • Ensure your devices have good wifi signal where they are located.
  • Periodically rebooting your devices ensures the latency is reset (system is usually very aggressive when increasing latency, but not so much when decreasing it) to the base level.
  • Enable debug logs for the audio service (set AUDIO_LOG_LEVEL=debug environment variable). With debug logs you’ll usually see messages like Loopback latency at base rate is 200.31 ms every now and then, you can monitor the latency with that.

Than you
I am streaming from my iphone. for airplay
thank for the tips