phetsims / wave-interference

"Wave Interference" is an educational simulation in HTML5, by PhET Interactive Simulations.
MIT License
19 stars 5 forks source link

Some audio clicking when tone ends #384

Closed samreid closed 5 years ago

samreid commented 5 years ago

@jbphet says there can be some clicking when an audio clip ends. You can use delay parameter on stop, like 10ms. And also set the volume to 0, something like stop(10ms). Probably can use the default time constant for setOutputLevel(0). If you still hear the clicks, adjust the time constant.

samreid commented 5 years ago

I added 10 then 100 ms delay to the stop call and still heard the clicking when the tone ends. The problem seems to be happening on this.oscillator.disconnect( this.masterGainNode );. I wonder if we need to schedule that for after the stop delay has occurred? @jbphet can you please advise?

samreid commented 5 years ago

@jbphet and I looked into it. SoundGenerator is already doing the fade out, we just need to wait until the fade out is complete before stopping the oscillator. Committed, tested and closing.