Fading out Audio

I have elements that on Mouse Down a tone is played and on Mouse Up the tone stops. Is there some way to have the tone fade out quickly on Mouse Up so that the sound of “clicking” is not audible?

Thank you!

Hi Matt, where is the “clicking” sound coming from? I don’t seem to hear a click on my tests. There is an old thread about fading sounds on the old forum that might help…


1 Like

The link above should help you. Basically, in javascript, think of decreasing the volume over a period of time using setInterval() and the .volume property.


1 Like

The above link doesn’t appear to work anymore. Did you ever come up with a solution @matt5834? I’m trying to make a piano keyboard and I’m hoping to get that effect. Thanks!


What about @DBear’s suggestion does not work for You?

Here’s how that code would look:

Thanks, I’ll give that a shot!