Problem with really long latency BalenaSound

Hello,
I have problem with my Raspberry Pi4 with Hifiberry DAC+ Standart with Balena OS + BalenaSound.

I bought this whole setup just to control my speakers via Apple Airplay and Spotify Connect. The problem is extremely long latency (from moment, when I stop the music and the speakers stop playing, is it like 1,5 - 3 seconds). This is for my totally unacceptable. :frowning:
(Tried from notebook, tablet and phone). How does it work for you??

I tried to read to Documentation of BalenaSound (https://sound.balenalabs.io/docs/) but haven’t really found any solution to this problem. :disappointed_relieved:

Even the Bluetooth via RasPi is much much worse (big latency and unstable as well) than Bluetooth from the speakers.

I am thankful for any respond to this question and help. Thank you in advance :slight_smile:

soundsystem_dawn-forest-29.09.pdf (64.7 KB)

Hello @Filip,

There is latency designed into the AirPlay protocol that prevents playback from having gaps and skips. The delay is around 2 seconds. It allows the playback devices to keep in sync when issues occur on your network. WiFi is particularly difficult to work with when trying to keep data timing accurate.

There is also some delay in the snapcast protocol (multi-room distribution) as well, mostly due to having to keep the audio data in sync. It’s not designed to have latency. It’s just a fact of having to synchronize many playback devices on a network. Again, WiFi makes this more of a challenge for the protocols to keep your music in sync between playback devices.

You will also encounter different amounts of latency for different playback devices. For example, I have integrated all of my family’s computers into the balenaSound system, and those devices have almost 150 ms delay, compared to the Raspberry Pi devices. I am able to correct that on the individual computers. but not in balenaSound (as far as I know so far).

There really isn’t any way to correct for the major latency in the system. It’s a core element of synchronized multi-room sound, which is unavoidable at best, and actually necessary to maintain audio quality.

However you can adjust latency if you are having issues with playback being out of sync between devices. The first thing to do for that is start rebooting devices. They usually clear up after that. If reboots don’t work, you will need to try setting an environment variable on some or all of your devices with specific latency values. See this doc for info on that: https://sound.balenalabs.io/docs/customization#multi-room (look for SOUND_MULTIROOM_LATENCY).

Cheers!
Mark-

1 Like

Disabling the multiroom option (if you’re not using multiroom) will reaaaally help.

add ‘SOUND_MODE’ as an enviroment variable and ‘STANDALONE’ as the value.

This is only the case when you press play, but the stream is pretty spot on latency wise afterwards.

I’ve tested it now. Airplay just have still about 2,5 seconds latency. But Spotify Connect improved, about 1-1,3 seconds, which is better.