Transmitting sound from my Linux laptop to Balenasound on a RPi3+ via bluetooth, I have about 2 seconds latency.
I read on another forum that this is because of the time to A2DP encode the sound on my laptop, but if that’s the case, why is there no latency when I use portable Bluetooth speakers with my laptop?
If that’s the issue, would it be possible, I wonder, to omit A2DP in cases where sync is more important to me than fidelity?
(Apologies if I’m posting this in the wrong forum category; I took my best guess.)
Hello, from my understanding its not really possible to avoid A2DP as it is used to transmit audio over bluetooth, however Im not sure if there is a lower quality protocol to fallback in case of latency. I asked the balena sound team more information about this and will get back to you as soon as I hear from them. In the meantime I would be curious to know if you experience a comparable delay when transmitting audio from a different device (e.g. a phone to balena-sound)
Thanks. Yes, I tried transmitting from an Android phone and I get the same delay. There is no delay when transmitting from either of these devices to a separate Bluetooth speaker.
I’m no expert but it might be difficult to get it lower. It might be possible to tweak some of the A2DP configuration or use a different lower latency codec, but none of us have had much experience with that. I have pinged the core maintainers of balenaSound to weigh in here and perhaps they will have better ideas than I do
Hi there, balenaSound maintainer here. Currently there is not much else we can do with regads to the latency, mostly due to limitations of the bluetooth stack we are using for this project. Can I ask what value of --pcm-buffer-time you are using?
I can tell you though that the next major release of balenaSound (3.0) will hopefully address this. It’s still in very early stages, but the results so far are very promising with pretty much no latency.
Hi again - the --pcm-buffer-time is set in the bluetooth-audio/start.sh file - so if you haven’t changed that, it will be the default of 1000000. I’ve not played with trying to reduce latency myself, so I don’t know what you might try setting it to - but you could experiment and let us know if it helps at all.
Hey - yeah it will be a tradeoff between the stability of the audio stream and it’s latency. You’re forging a path here, so we’d be glad to hear what you find. If you think that a lower setting works better, we may either change the default or add your findings to our troubleshooting page.
Been streaming for 30 minutes now on the 10000 setting with no hiccups. I made it an environment variable so I can adjust as needed – maybe that would be helpful for others.
Hi, I’m completely new to Balenasound, I run into the same problem with 2 sec. latency.
Can you give me a quick step by step guide on how to change the value of this variable and how to link it to a environment variable.
Is reducing the --pcm-buffer-time still an option with the current version (3.6.9) of balena sound? even with multiroom and airplay disabled, the bluetooth delay is lika half a second…
This has been improved in the latest version of balenaSound. You can change the latency with the SOUND_INPUT_LATENCY env var. See here for more information.