-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
SDL3: Constant crackling sound in 02-simple-playback-callback
on Debian with Chromium and Firefox
#11930
Comments
In case it helps with debugging: I tried on my device (Ubuntu 24.04, Linux 6.8.0-51-generic, Firefox 134.0) and the example works fine (a constant sine wave). I haven't tried with the exact same configuration, but it might probably be an OS-specific issue. |
Try the same example with a massive buffer size: And let me know if it still crackles. |
No, the constant crackling sound isn't happening anymore! At first, it was a bit audible the crackling sound (both in Chromium and Firefox), but once it stabilized, it could be heard clearly. Update: I am using Xfce 4.18.2. |
Some systems seem to not keep up with the smaller buffer. Reference Issue #11930.
Try this one now, without any URL parameters added to it: https://examples.libsdl.org/SDL3/audio/03-load-wav/ If it doesn't crackle, we're good to go here. |
That example you attached worked without having to multiply the buffer size by two (although I always hear the crackling sound from time to time). Moreover, I'm currently testing starting from the original example 4, and I’m not having any issues in Emscripten (maybe because I'm running in localhost?). That is, audio examples 1, 3, and 4 worked fine for me without multiplying the buffer size by two. The problem lies with example 2, which uses a callback and a background thread. This one still fails for me now: https://examples.libsdl.org/SDL3/audio/02-simple-playback-callback/ Perhaps it's just me, but it's specifically with this example and the configuration I shared. |
Hmm, yeah, I can trigger this if I cook all my CPU cores, like running a build with the web browser in the background. (Obnoxious audio in this clip.) trim.479390D0-AABF-4ECC-986F-BCBAF7C9EAA9.MOVEven if I set the buffer size to be massive, it still has issues under external load. There's probably not much I can do about that. |
I am trying to export the example to support threads on the web. However, the web requires a cross-origin isolated website. On itch.io, it allows the experimental Shared Buffed Array. If the exported example does not support threads, it is more prone to performance and audio issues. Right now, I'm trying to compile the example in Emscripten with |
(I think you just need SDL works with threaded Emscripten, but even when built with thread support, it doesn't use a thread for audio, because the browser interface we use for it just runs in idle time in the main thread. The "threaded" solution is to use an AudioWorklet, but it literally doesn't work with pthreads, so it was a non-starter for SDL (and almost everything else, too). |
Description:
When running in the web the
02-simple-playback-callback
audio example from the SDL3 repository (link), a persistent crackling sound is heard.Steps to reproduce:
Expected behavior:
Audio should play smoothly without any crackling or artifacts.
Actual behavior:
A constant crackling sound is present during audio playback.
Environment:
Additional Information:
The issue has been consistently reproduced on two separate machines with similar configurations. It is suspected that the threading implementation in Emscripten might be causing the crackling sound in the audio playback example.
The text was updated successfully, but these errors were encountered: