-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Cracking audio with Godot 4 no-threads Web builds #87329
Comments
Same issue on Android 14 with a Pixel 7a, both with Firefox Beta 122.0b9 and Chrome 120.0.6099.210. |
Windows 11 v23H2 here (full specs later). I'm also getting audio cackling in your example project on Firefox, Chrome, and Edge. It sometimes sounds fine probably when the game is running at full speed though. Firefox 121.0.1: Firefox.1.mp4Notes: Similar results to the post above, but it runs a lot smoother on my end due to better specs. Microsoft Edge 120.0.2210.144 (WARNING: FLASHING COLORS): Edge.1.mp4Notes:
Google Chrome Version 120.0.6099.225: Notes: Exact same results as Microsoft Edge (see video above). Broken intro screen, good audio after shader compilation, audio breaks when exiting fullscreen. Here are my specs:
|
I'm a newbie in this, but maybe we could use Web Audio backend code from miniaudio library in Godot? |
The audio in my game runs perfectly when I run the linux release export, but my game isn't cpu intensive so this isn't very significant. Anyway, two things caught my attention. Firstly, audio from MRP on itch.io is of low quality, but when I switch to another tab, the audio quality suddenly increases to near perfect. I use firefox 122.0 64 bit. Secondly, the game is completely silent when I launch my game from the editor with f5, however as I said previously, it works in the export.
Edit: updated the specs to ones printed out by inxi. Also, the thing where switching to another tab improves audio quality also works on Chrome, but I think that this is happening just because looking away from the game is optimized and reduces cpu load. |
I noticed that audio is broken regardless of whether I export with the option "Thread support". Of course when I export from the normal editor with normal templates (built without --treads=no) it still works. |
If you increase audio output latency.web to 90 it mostly goes away. |
This... Actually works, thanks! Hopefully that can help track down the issue. Latency.web 50 (default) - audio starts at 0:17 - Notice the insane crackling in the game over screen 50_latency.mp4Latency.web 90 - audio starts at 0:11 - Audio has minor skips on frame drops but does not crackle 90_latency.mp4 |
@jasonwinterpixel Mentioned using Latency.web 150 in Godot Engine 3, but I didn't get the complete details on what harm this causes. |
It seems like audio should only crack if the CPU is maxed out. If the CPU isnt maxed, it should be able to fill the buffer properly. In the case where the CPU is maxed, the audio should stop and not 'ring' around the other side like it does in web on godot 3 right now. We use a high audio latency in our games in single threaded builds, and tbh it bothers me quite a bit. I think I'd only be willing to tolerate ~50ms of audio latency. |
Needs testing on several projects/devices, but I suggest we look into increasing the default audio latency for the Web export in 4.3, mitigating the current issues. I agree with @jasonwinterpixel that high latency is a bother, but it's better than the kind of cracking we have currently. It's not a long term solution, but it should be a good first step to make things at least usable. |
Just FYI changing the audio output latency.web from 50 to 90 fixed the crackling issue almost entirely (having about 4-6 audio players procedurally playing different sound layers and only sometimes a tiny bit hickup, but the sound stays clear), for this jam game: https://graphific.itch.io/bird-ruckus |
FYI too: |
…g on web. Per this comment: godotengine/godot#87329 (comment)
Tested versions
Reproducible in 4.3.dev (1952f64) with a
threads=no
Web template.The issue was "introduced" in #85939 since it wasn't possible to make single-threaded Web builds in Godot 4 before that.
System information
Mageia 9 - Vulkan (Forward+) - dedicated AMD Radeon RX Vega M GL Graphics (RADV VEGAM) () - Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz (8 Threads)
Issue description
The newly reintroduced single-threaded Web export has audio issues, as expected.
On my Linux system, it's pretty dire on any demo that has background music, sfx, and any game logic or rendering effort that's non trivial (i.e. the CPU is kept busy).
Here's an example with the GDQuest TPS demo, uploaded to itch.io, with threads disabled (built from #85939):
https://akien.itch.io/godot4-nothreads-audio-test
(Ignore the weird rendering (Compatibility while the demo is designed for Forward+) and the fact that rotating the camera with the mouse seems to be broken in the Web build.)
Here's how the game sounds like on a native Linux build (editor):
simplescreenrecorder-2024-01-18_12.13.30.mp4
Here's the
threads=no
Web build (debug) on currently Firefox Nightly (123.0a1 (2024-01-17)) on the same Linux system:simplescreenrecorder-2024-01-18_12.07.44.mp4
And the same on Chromium (120.0.6099.216) on the same Linux system:
simplescreenrecorder-2024-01-18_12.16.01.mp4
The issue is likely linked to OS, browser, and CPU, so for testers who can or cannot reproduce it, please include full info about what platform you tested on.
Steps to reproduce
master
withthreads=no
)Minimal reproduction project (MRP)
https://akien.itch.io/godot4-nothreads-audio-test
The text was updated successfully, but these errors were encountered: