0 votes

So, i'm adding sounds to my game and i'm experiencing a strage bug with the AudioStreamPlayers. Every time I play a sound that doesnt have a blank second on the beggining, it's beggining flickers. here's a video showing the problem
https://youtu.be/vMNw2dLThpo
as you can see, when i try to use the immediate audio, it flickers on the beggining, but when i use the audio with 0.8-1 blank second on the beggining, it doesnt flicker. ( and the sounds don't flicker on the editor too )
I already tried using AudioStreamPlayers and AudioStreamPlayer2Ds ( note that the sfx comes only from the left side cos i forgot to set its position )
And I tried to use .ogg and .wav files too

in Engine by (21 points)

2 Answers

0 votes
Best answer

So, now i know the problem. I was calling the play function when a key were pressed ( i'm using Input.isactionjustpressed ). isactionjustpressed triggers for some frames instead of just 1 IF you're loading it on _process, so i just need to change the Input handling to _input() instead of _process()

by (21 points)
0 votes

I suspect that has to do with this filed bug report: https://github.com/godotengine/godot/issues/22016

Some other things to check: Make sure the 'Trim' and 'Normalize' import settings haven't messed with anything. And make sure the files are 44100Hz. I have previously had a lot of issues with playback being messed up in the editor whenever the Mix Rate was higher than 44100.

by (41 points)

i alrready tried enabling/disabling trim, normalize, and all of the other options and the files are in 44100Hz, and so is the max rate ( I tried different rates too )

In that case perhaps all you can do is wait for the bug to be resolved. As far as I know the issue was resolved and merged into the branch, so the next Godot Update should likely fix your issue.

But do read the GitHub Issue, and report a new issue if you think your bug is different.

So, now i know the problem. I was calling the play function when a key were pressed ( i'm using Input.isactionjustpressed ). isactionjustpressed triggers for some frames instead of just 1 IF you're loading it on _process, so i just need to change the Input handling to _input() instead of _process()

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.