Working out a BPM function in JS, where I'm playing a short sound for x times in one minute.
But it's not working for me, and this is what I have. Can't find anything on this either.
The math should be simple: L*BPM/M, Length * How many times / 60 seconds.
I have tried with something like this:
var length = 0.5;
var bpm = 60;
var minute = 60;
for(var i = 0; i < bpm; i++) {
setTimeout(function() {
console.log('test');
}, ((length*bpm) / minute * 1000 ) * i);
}