Last active
August 29, 2015 14:04
-
-
Save ltackett/e68ce1f3392544dacb0e to your computer and use it in GitHub Desktop.
Simple JavaScript examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BPM = 120; | |
var BPB = 4; | |
var msFromBPM = Math.round(60000/BPM); | |
setInterval(function(){ | |
if (typeof(beat) === 'undefined') { beat = 1 }; | |
if (beat === 1) { console.log('BLEEP', beat) } | |
else { console.log('bloop', beat) } | |
if (beat === BPB) { beat = 0 }; | |
beat++; | |
}, msFromBPM); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment