What i'm trying to do is making a piano song with individual sound files for the piano claps. I did a version of it in javascript, with WebAudioAPI, using an oscillator instead of audio files. Here's a part of the code out of context:
var ctx = new AudioContext();
var time = ctx.currentTime;
for(...){
osc = ctx.createOscillator();
osc.start(time);
time = time + 3;
osc.stop(time);
osc.disconnect(time);
}
I don't know how to stop an audio file like i did with the oscillator. (P.S.)I only kept the part of the code that was relevant to my question, so please ignore the functionality of it.
Thank you!