You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description:
There are a few situations where playing a sound AudioStreamPlayer3D results in pops or crackles. The easiest to reproduce has something to do with the positional logic. The surround sound logic changed between 3.1 and 3.2, so I thought maybe it was fixed, but even with the new 3.2 positional code, it still has the pops.
I replaced my character's footstep sounds with sine waves, and it became VERY clear that there was something wrong.
It looks like there are actually 2 problems: One, seen in the top channel, is an abrupt volume/amplitude change. The second, shown in the bottom channel, shows the sine wave getting out of phase. I think it's actually playing the sound again at a later time and blending it (also followed by an abrupt amplitude change).
The abrupt change seems to happen at 21ms, which, at a 48000 sample rate is pretty close to the 1024 buffer size. My guess is the first buffer somehow has bad data and is mixing/fading incorrectly.
I dug into the code for a while, but couldn't identify the exact problem. From the looks of it:
AudioStreamPlayer3D::play() indicates the player is active and enables the physics process.
AudioStreamPlayer3D::_mix_audio() is called from a separate thread. Data isn't set yet, so it fills the buffer with 0's (this is probably not great, as it likely delays the sound, but shouldn't cause a pop).
_calc_output_vol() called when there's a NOTIFICATION_INTERNAL_PHYSICS_PROCESS, which sets proper data.
Seems there is something wrong with the first buffer every time:
You can see here that sometimes the amplitude is scaled up, and sometimes it's scaled down. Rarely is it ever at the volume it should be (unless maybe the sound is played at a location very close to where it played previously?)
Other pops:
There are 2 other pops I'm aware of that may or may not be part of the same issue. Perhaps they should have their own bug entry once this is fixed.
A rare, but very harsh pop that happens seemingly at random. Does not appear to be position related (I hardcoded the location to test). Can't figure out a consistent repro for this one.
Calling stop() on a looping sound.
Steps to reproduce: Play a sound on an AudioStreamPlayer3D, then move it to a new location relative to the camera and play it again. Really obvious when you move from the left to right side of the listener (see attached project).
Godot version: 3.1.2, 3.2 rc4
OS/device including version: Windows 8.1
Issue description:
There are a few situations where playing a sound AudioStreamPlayer3D results in pops or crackles. The easiest to reproduce has something to do with the positional logic. The surround sound logic changed between 3.1 and 3.2, so I thought maybe it was fixed, but even with the new 3.2 positional code, it still has the pops.
I replaced my character's footstep sounds with sine waves, and it became VERY clear that there was something wrong.
It looks like there are actually 2 problems: One, seen in the top channel, is an abrupt volume/amplitude change. The second, shown in the bottom channel, shows the sine wave getting out of phase. I think it's actually playing the sound again at a later time and blending it (also followed by an abrupt amplitude change).
The abrupt change seems to happen at 21ms, which, at a 48000 sample rate is pretty close to the 1024 buffer size. My guess is the first buffer somehow has bad data and is mixing/fading incorrectly.
I dug into the code for a while, but couldn't identify the exact problem. From the looks of it:
Seems there is something wrong with the first buffer every time:
You can see here that sometimes the amplitude is scaled up, and sometimes it's scaled down. Rarely is it ever at the volume it should be (unless maybe the sound is played at a location very close to where it played previously?)
Other pops:
There are 2 other pops I'm aware of that may or may not be part of the same issue. Perhaps they should have their own bug entry once this is fixed.
Steps to reproduce: Play a sound on an AudioStreamPlayer3D, then move it to a new location relative to the camera and play it again. Really obvious when you move from the left to right side of the listener (see attached project).
Minimal reproduction project: sound_pop.zip
The text was updated successfully, but these errors were encountered: