I'm experimenting with porting a simple audio utility called VoiceWalker to Javascript. VoiceWalker is a tool to help people transcribe audio, and it works like this:
https://i.stack.imgur.com/wyl1J.png
So the idea there is that it plays a bit, repeats it, scoots forward, plays another bit, repeats that, scoots forward, etc.
I've cobbled together a function to play a sound clip, it looks like this:
function clip(audio, start, stop){
audio.currentTime = start;
audio.play();
int = setInterval(function() {
if (audio.currentTime > stop) {
audio.pause();
clearInterval(int);
}
}, 10);
}
It's an easy proposition to come up with a list of start/stop times that match the pattern above, but there's one problem: how do I queue up my clip()
calls so that one will only run after the other has stopped?