Hi, when I play spotify through balenaSound on my RPi4 I hear tiny gaps/pauses in the sound approximately every 10-20 seconds. Looking in the log they’re matching these warnings: W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 340.00 ms
and the number of ms is always increasing.
So we have a troubleshooting guide here - https://sound.balenalabs.io/docs/support/#troubleshooting
And it has some stuff that we can try before diving deeper (in the guide it’s for bluetooth, but these are some good to check things regardless)
what power supply are you using?
are you using multiroom feature? If yes, how does it work after you disable it? Pi4 is pretty beefy, so resource utilization shouldn’t be a problem. But depending on your environment (i.e. ambient temp) it could be. If you aren’t using it, best to disable it and check. See our guide for this here - https://sound.balenalabs.io/docs/docs/customization/#general
Thank you for looking into it. I’ve tried to disable multi room (byt setting SOUND_MODE to STANDALONE) and looks like it helped. I will try it again with multiroom enabled soon just to confirm it was the reason.
Thanks for the additional info. Let us know if you’re able to confirm that enabling multiroom again brings the symptoms back.
One thing you may want to check: the version of balenaOS you have reports CPU and temperature information back to the dashboard. It would be worth seeing if either are particularly high; high temperatures in particular can lead to cpu throttling, which may exacerbate this problem. Another way to check this would be to run device checks from the Diagnostics tab on the dashboard, as we check for CPU throttling there. If you see high temperatures or CPU throttling, pointing a fan at your Pi would be one way of testing this.
Hi there, thanks for the report, I’ll notify the maintainer. The other thing I am curious about is the type of SD Card being used, if it’s perhaps not quick enough to keep up with the read/write. We recommend Sandisk Extreme Pro, with a UHS 1 or A1 rating.
Hi All, long time experimenter first time poster.
Can confirm I had similar issues today when testing this out, often stuttering with pulse audio having to increase the latency.
([pulseaudio] module-loopback.c: Too many underruns, increasing latency)
Have also tried converting to standalone and has resolved the issue so far with about 35 minutes of constant playback testing.
Tested with RPi3, 16GB factory class 10 card, Samsung Evo card with same results.
Genuine RPi PSU used to ensure enough amps.
Happy to supply more information if it is of any use.
Hello, balenaSound maintainer here. Switching to STANDALONE mode shouldn’t have this type of impact with regards to the underruns, at least in theory. Since we have two data points indicating the contrary in this thread I think I need to go back and take a deeper look to see what’s going on.
There is an ongoing GitHub issue where this was initially reported (see here). I’ll keep the discussion and results of my investigation over there, so feel free to drop by or subscribe to the issue if you are interested in it’s resolution.
I have the same issue, I have two devices RPi 3. I have disabled every feature plugin, besides spotify-connect on the multiroom-master Pi (the other is running as multiroom-client), and pi3-disable-bt on both. I did this thinking it’d be good to run as lean as possible.
Only the Pi running as multiroom-master reports these underruns, the client does not.
I have no idea what it means, and I probably don’t help much with this post.
12.11.20 15:41:26 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 245.00 ms
12.11.20 15:41:36 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 250.00 ms
12.11.20 15:42:06 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 255.00 ms
12.11.20 15:42:36 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 260.00 ms
12.11.20 15:42:56 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 265.00 ms
12.11.20 15:43:36 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 270.00 ms
12.11.20 15:44:06 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 275.00 ms
12.11.20 15:44:46 (+0100) audio W: [pulseaudio] module-loopback.c: Too many underruns, increasing latency to 280.00 ms
Hi Calle, thanks for sharing this. Every bit of information helps! I’ll see if I can prioritize this and get to the bottom in the next couple days/weeks.
I have noticed that there are periodic glitches that affect all speakers at the same time. In my case, only my RPi Zero W devices have individual glitches, which I sort of understand the source of. But the fleet will have tiny glitches on a regular cycle that seems to fluctuate between about 15 seconds to a minute or so. The glitches are usually a very brief time jump, and then a few seconds later a very brief time delay, as if something shifted and then returned to normal.
I have the same issue as reported above — and it’s driving me nuts
In my case though, the problem is way worse when using the spotify service. Playing via Airplay or Bluetooth renders with fewer gaps/crackling episodes.
One other interesting thing: if I mess around with the volume control in Spotify, I notice the crackling sound appearing right after. I’ve tried it with the Spotify player on both my Android phone and my Mac.
Also tested using different speakers and different cables.
If you can help me out here I could use some logs with extra verbosity. You’ll need to set environment variable AUDIO_LOG_LEVEL to DEBUG and then share with me the logs. You’ll know it’s on DEBUG mode because logs will show the following:
Here are three logs, one froma RPi 4B, which is my mr-server, one from a MR client-only RPi Zero W that is running nothing but the audio and mr-client containers (a custom build). And the third is from a RPi 4B, running as a regular mr-client, using env vars to set the mode. I have not yet played any music. This is just what was logged shortly after setting the logging to DEBUG. I’ll get logs while playing later tonight.