I'm working on a morse code audio player. I play each sound with this function:
function playSound(n: number): void{
if(n === 0){
let sound = new Audio("../audio/short.mp3");
sound.play();
}
else if(n === 1){
let sound = new Audio("../audio/long.mp3");
sound.play();
}
else{
let sound = new Audio("../audio/break.mp3");
sound.play();
}
I call it here:
for (let j = 0; j < nummers.length; j++){
playSound(nummers[j]);
}
But when I call this function multiple times the sound are playing in parallel. Who can I play one after another?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/8QwYeNS
Comments
Post a Comment