New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio stuttering & PulseAudio "complaning" #294
Comments
@b3nis hm this sounds weird. Can you try setting it to Standalone mode? |
@AlexProgrammerDE i have similar problem but for me there is no any audio. How i can switch to Standalone mode? |
Hi @b3nis @duchu, switching to standalone won't change much. These underruns happen because PulseAudio starts with an aggressively short playback latency and increments it as needed. In my experience, it can happen quite often (as seen on the screenshot) when you start playback but will quickly stabilize and stop happening. Has this been your experience too? Regardless, I'm investigating how we can be more lenient with the initial latency to avoid this problem. I've got a couple of avenues worth exploring but it might take a few days. |
[tmigone] This issue has attached support thread https://jel.ly.fish/59d9e7d8-26e1-4672-a289-fa6213841421 |
A couple users reported switching to Also copying the warning message in plain text so it's easier to find it using search:
|
I am experiencing the same issues on a RPi 3B running 2.60.1+rev1. Stutter roughly occurs about 10 to 20 times a song and it isn't always the same length, it can be as short as 0.05 seconds, barely noticable but also up to a full second and everything in between. Sometimes I see the underrun message when it happens but sometimes I see different messages about Alsa failed to get chunk, see log snippet below: 05.11.20 16:56:59 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 340.00 ms Don't know if that could be related? I have tried DISABLE_MULTI_ROOM = 1 which makes it less but doesn't completely resolve it. Load on the Pi is low, everything but memory is green in Balena but memory, max load on the device comes from pulseaudio which is about 6 a 7 percent on the host OS. In balena total load doesn't reach above 15%. Temp is 50c. |
If you guys can help me out here I could use some logs with extra verbosity. You'll need to set environment variable
What I'm looking for in the logs is instances of this error occurring, so make sure you get a few:
Thanks! |
@tmigone balena-sound2_white-snow-19.11.20_23_27_54_(+0100).txt Bye the way if I can give you access to the devices or something that's fine by me! |
Thanks @xvisor16, for the time being this should suffice. I'll let you know if I need access. Thank you. |
- Update snapcast to v0.22.0-r0 - Replace FIFO stream source with ALSA which significantly reduces CPU and I/O usage (fixes #294) - Reduce multiroom-server image with multi stage builds for a slimmer image - Reduce verbose level for both multiroom services Connects-to: #294 Change-type: minor Signed-off-by: Tomás Migone <tomas@balena.io>
- Update snapcast to v0.22.0-r0 - Replace FIFO stream source with ALSA which significantly reduces CPU and I/O usage (fixes #294) - Reduce multiroom-server image with multi stage builds for a slimmer image - Reduce verbose level for both multiroom services Connects-to: #294 Change-type: minor Signed-off-by: Tomás Migone <tomas@balena.io>
- Update snapcast to v0.22.0-r0 - Replace FIFO stream source with ALSA which significantly reduces CPU and I/O usage (fixes #294) - Add SOUND_INPUT_LATENCY and SOUND_OUTPUT_LATENCY env vars (also help with #294) - Reduce multiroom-server image with multi stage builds for a slimmer image - Reduce verbose level for both multiroom services Connects-to: #294 Change-type: minor Signed-off-by: Tomás Migone <tomas@balena.io>
- Update snapcast to v0.22.0-r0 - Replace FIFO stream source with ALSA which significantly reduces CPU and I/O usage (fixes #294) - Add SOUND_INPUT_LATENCY and SOUND_OUTPUT_LATENCY env vars (also helps with #294) - Reduce multiroom-server image with multi stage builds for a slimmer image - Reduce verbose level for both multiroom services Connects-to: #294 Change-type: minor Signed-off-by: Tomás Migone <tomas@balena.io>
@xvisor16, @duchu, @b3nis, @ChestersGarage hey there. I just opened PR #356 which contains changes that should fix or at the very least drastically improve the audio stuttering related to the message:
Changes made are the following:
As you can see, 1) is the actual fix while 2) is just an additional workaround. My hope is, and the limited testing I've done is in line with it, that you shouldn't need to set the If you are interested in more details about this you can check the following:
Now the big ask :D I'd love it if you could try it and let me know how it goes! You'll need to deploy the application using the balena CLI or use this handy dandy DWB I created just for this purpose: Thanks! |
- Update snapcast to v0.22.0-r0 - Replace FIFO stream source with ALSA which significantly reduces CPU and I/O usage (fixes #294) - Add SOUND_INPUT_LATENCY and SOUND_OUTPUT_LATENCY env vars (also helps with #294) - Reduce multiroom-server image with multi stage builds for a slimmer image - Reduce verbose level for both multiroom services Connects-to: #294 Change-type: minor Signed-off-by: Tomás Migone <tomas@balena.io>
@tmigone Hi there, well one simple but satisfactory answer, YES! You fixed the issue, my Pi3 doesn't even up the latency at all, not even once! Thanks, now I can really start building my complete setup. By the way, could I also experiment by setting the sound_input_latency even lower? Maybe like 50ms so it's more responsive?? |
Aw well I already tried, and found that's not possible... 25.11.20 02:47:07 (+0100) audio D: [pulseaudio] module-loopback.c: Loopback overall latency is 10.64 ms + 39.93 ms + -0.48 ms = 50.03 ms But I am happy anyway! |
Hey @xvisor16, glad this makes things better for you!! 💪 💪 💪 💪 I'll merge the PR soon so that it hits the master branch as I've seen mainly great feedback about it. Thanks again for helping out! |
- Update snapcast to v0.22.0-r0 - Replace FIFO stream source with ALSA which significantly reduces CPU and I/O usage (fixes #294) - Add SOUND_INPUT_LATENCY and SOUND_OUTPUT_LATENCY env vars (also helps with #294) - Reduce multiroom-server image with multi stage builds for a slimmer image - Reduce verbose level for both multiroom services Connects-to: #294 Change-type: minor Signed-off-by: Tomás Migone <tomas@balena.io>
- Update snapcast to v0.22.0-r0 - Replace FIFO stream source with ALSA which significantly reduces CPU and I/O usage (fixes #294) - Add SOUND_INPUT_LATENCY and SOUND_OUTPUT_LATENCY env vars (also helps with #294) - Reduce multiroom-server image with multi stage builds for a slimmer image - Reduce verbose level for both multiroom services Connects-to: #294 Change-type: minor Signed-off-by: Tomás Migone <tomas@balena.io>
Off course no problem all! Thank you for fixing it! Which is way more important 😉Cheers, Peter -------- Oorspronkelijk bericht --------Van: Tomás Migone <notifications@github.com>Datum: vr 27 nov. 2020 19:07Aan: balenalabs/balena-sound <balena-sound@noreply.github.com>Cc: xvisor16 <github@etict.nl>, Mention <mention@noreply.github.com>Onderwerp: Re: [balenalabs/balena-sound] Audio stuttering & PulseAudio "complaning" (#294)
Hey @xvisor16, glad this makes things better for you!! 💪 💪 💪 💪
In theory you can go with a latency as low as 1msec. In reality as you found out, the latency you configure is merely a suggestion made to pulseaudio, and it will increase if it's not possible to satisfy it.
I'll merge the PR soon so that it hits the master branch as I've seen mainly great feedback about it. Thanks again for helping out!
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.
|
I am using the my balena sound device as a pulseaudio tunnel sink as described in #422. Log output
The pulseaudio config on the laptop I'm streaming from is: Config, list-sinks and list-modules
|
Same here, lot of lag. So if press play, or move the volume higher on my bluetooth android, it takes more than 5s to respond. Raspberry pi zero w + hifiberry amp2. Also a lot of stutter, so repeats of the same phrase and cracks (music ringbuffer not fast enough filled?). Also a lot of "increasing latency". Just installed yesterday, so I guess the newest version? I have tried Pi MusicBox, almost no stutter, but it is still there. And latency is also 5s+. So at the moment with moode player, but willing to do experiments... |
Describe the problem
Audio is stuttering and PulseAudio is reporting a lof of underruns. Only using one Pi 4 (2GB) (server and client on same device).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No audio stuttering.
Screenshots
Device information
The text was updated successfully, but these errors were encountered: