Hi, I want to make an autofade function for a sound object.
Means when i press a button the sound gradually fades out to nothing.
My code looks like this right now:

function fade() {
for (var i=1; i<=100; i++) {
s.setVolume(s.getVolume()-1);}}

this works, but the loop is to fast of course to make audible changes to the sound.
Now how can I put something in the function that makes it wait for some moments between any decrement.... ?

Any help welcome