Skip to content
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

Fix audio crackling issues due to incorrect WASAPI buffer size #89283

Merged
merged 1 commit into from Mar 8, 2024

Conversation

AlexOtsuka
Copy link
Contributor

Hopefully, finally fixes #75109.

This is an extremely straightforward fix to an issue that has been plaguing Godot users as well as players for months. Obtaining the current max buffer size and subtracting the current padding size is the recommended standard practice when calculating the max amount of frames to request to GetBuffer(). However, Godot was previously using the period_frames value instead, which is significantly smaller and would cause issues such as crackling and slowdowns during audio playback.

I have done extensive testing and I am fairly confident in this fix, but this still requires a lot of testing by as many users with as many different audio devices and drivers as possible.

@jauwnio
Copy link

jauwnio commented Mar 8, 2024

Just tested with a previously problematic project on my Focusrite Scarlett 18i8. Absolutely zero crackling. Fantastic fix!!

@akien-mga akien-mga requested a review from reduz March 8, 2024 20:50
@akien-mga akien-mga added cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Mar 8, 2024
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes seem simple enough, so if users confirm this fixes the issue, this should be good to merge (and I'll cherry-pick it for 4.2.2 and 4.1.4).

@akien-mga akien-mga merged commit 377ce78 into godotengine:master Mar 8, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉 -- and a very significant one at that, this was a major pain point for a lot of users!

@akien-mga
Copy link
Member

Cherry-picked for 4.2.2.
Cherry-picked for 4.1.4.
Cherry-picked to 4.0 branch, though no further release is planned there.

@akien-mga akien-mga removed cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Mar 9, 2024
@AlexOtsuka
Copy link
Contributor Author

Now that this made it into 4.3 dev 5 and this can be tested there, I'm deleting my branch. Thank you everyone for the feedback, and @akien-mga for doing such a quick job reviewing and implementing this. I'm still keeping an eye on this bug and all the other WASAPI related audio issues that may arise, but it looks like nothing but great news so far!

@AlexOtsuka AlexOtsuka deleted the audio-fix branch March 16, 2024 06:56
@AlexOtsuka
Copy link
Contributor Author

Hi @sh4nnja,

This thread is about the pull request for the audio crackling bug. Since your issue seems unrelated, you should create a new thread for it in https://github.com/godotengine/godot/issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audio files distort inside Godot when using a Focusrite DAC
4 participants