crackling sound when recording on linux/webkit/alsa
Expected behaviour: Pressing CapsLock or Ctrl+Space, then ASDF etc lets me input notes in real time and hear the notes the same way as when clicking when they are being typed.
Actual behaviour: Once you press a note in "piano mode" there's a very intrusive crackle on everything, it persists on everything (playback, clicking) until refreshing the page.
Steps to reproduce:
Uninstall or disable the pulseaudio daemon
Run a webkit browser on Linux
Open BeepBox from the url, press CapsLock then ASDF
Notice the loud crackle
Tried:
Enabling pulseaudio - it works - but that interferes with other programs that run fine without it
Possible solutions tests and workarounds:
- I don't know for sure but it seems to me like something to do with buffering the audio frames. Maybe the piano mode feeds the sound system (alsa) real-time unbuffered audio frames and relies on there being a sound server running to sort out the underruns? Haven't looked into it yet. Maybe having an option in beepbox to use sound buffering when in "piano mode" is a way to go?
- I could make it a point to use
pulseaudiofrom now on but all audio in the browser works fine without it, even when recording from the mic so it feels like a workaround. to make it worsepulseaudiocrashes every once in a while for unrelated reasons
Didn't notice any relevant errors in the dev console.
If you have any ideas please let me know. Thanks in advance.
Edit: works as expected in firefox (no pulseaudio), running beepbox in firefox in another window as a workaround (ideally would like it to work with webkit browsers though)
Found a workaround that seems to work well for webkit browsers if you use alsa but not pulseaudio
In case anyone runs across the same issue do:
chromium --audio-buffer-size=512 --audio-process-high-priority
It requires a browser restart (make sure the process isn't running in the background with ps aux|grep chromium).
The nasty crackling when recording disappears completely and everything else seems to work OK
Note recording does bring low latency in order to precisely detect inputs on a midi keyboard. However, the main drawback of this is that audio quality is usually butchered with crackly noises, and this is reset to the default state upon the program restarting, in this case, the tab being refreshed.