samtupy / nvgt

The Nonvisual Gaming Toolkit
https://nvgt.gg
Other
43 stars 27 forks source link

Glitching/clicking with rapid volume changes for positioned sounds with HRTF enabled (even when sliding) #59

Open ns-studios opened 3 weeks ago

ns-studios commented 3 weeks ago

I ran into an issue where rapid volume changes, e.g., fading out, result in really unpleasant-sounding glitches/clicks/buffering for positioned (not at listener's position) sounds when HRTF is enabled, even when using sliding. The rapid changes are especially unpleasant, but there are also clicks for changing volume abruptly, e.g., muting and unmuting a sound creates extra clicks with HRTF on, as well as certain sounds like camera air sound that aren't faded extremely well at the end generate a click where one isn't present without HRTF (usually the farther sound is positioned to the right, the click from it seems to move farther and farther to the left on the opposite side of the listener, and vice versa). The clicks don't happen if HRTF is enabled and the sound is at listener's position, or HRTF is turned off. The only way I've found to get clean-sounding fades is to use mixer.set_fx with the linear volume effect. Attached is an example script that plays tada.wav from windows media folder, and fades it out first with sliding, then second without sliding, i.e., just sound.volume, and third/last uses mixer.set_fx. Also attached is audio demo of me running this script. clicks.zip Forgot to demo mixer.slide_volume in the script, but that also glitches.

valiant8086 commented 3 weeks ago

I can reproduce this using the sample nvgt. On my system the first two tests chatter and the last one is smooth. They're making noises (pun intended) about switching the sound engine to miniaudio or some such so maybe that'll be a fix anyway.