online metronome code example Example: metronome var bpm = 80; setInterval(function() { //play a sound }, Math.round(60000 / bpm));