oto: Stutter on Raspberry Pi 400 using example
NOTE: I’m actively investigating this, but I thought I should put in an issue in case others are (or aren’t) seeing the same problem.
Raspberry Pi 400 (ARM v8) Default Pi OS that ships with Pi 400, but updated via apt to latest. HDMI audio. go 1.15.4
Effects:
go run example/main.gousing master at time of posting ( 7f7e156100089346d897740cd0eba0a00c488751 ). The notes are not clear, they stutter quickly and continuously at the same interval.- If I increase
bufferSizeInBytesin theNewContextcall the stutter becomes less frequent, when I reach 80KB (the example starts at 4KB) it is an occasional pop every few seconds. - CPU usage is <10% on all cores when testing.
- If I increase
- When using Oto via Ebiten to play mp3 music it plays slowly and with stutter - not sure if that’s indicative of buffer under-run (maybe specific to HDMI audio?)?
aplay plays wavs on the Pi without issue.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 16 (7 by maintainers)
Sounds the same - i.e., no buffer underrunning. There’s a click as each note disappears, but I would assume that’s due to a lack of zero crossing cutting.
I notice I’m getting a bunch of warnings that you’re not. Looks like a cast is missing somewhere perhaps.
@hajimehoshi
I was hoping @Asday would get a chance to try the above two branches on Linux desktop so I can confirm the theory that it doesn’t use buffers of the same size. At the moment I can’t tell if this is a general Linux problem that just happens to be fine on linux desktop, or if it’s specifically the RPi that’s at fault.
@Asday
thank you ❤️
For reference this is the output I get on the RPi 400 for branch
debug-buffer-sizes(which stutters)…And this is the output on RPi 400 for branch
rpi400-fix(no stutter)…I happen to be lucky enough to own a Linux desktop. If you’d like to throw together an SSCCE in the form of a git repo, I’ll gladly clone it and become a guinea pig.
If anyone else is playing around with this, this is what I did to ‘fix’ it…
I’ll keep investigating before suggesting a PR. I really need to test this on linux desktop.
The pops and clicks definitely occur at the same time snd_pcm_writei returns -C.EPIPE - which indicates a buffer underrun from alsa (as suspected). But I’m no closer to working out why, yet.