Skip to content

Instantly share code, notes, and snippets.

@mikemunsie
Created April 3, 2014 04:56
Show Gist options
  • Save mikemunsie/9948473 to your computer and use it in GitHub Desktop.
Save mikemunsie/9948473 to your computer and use it in GitHub Desktop.
var bpm = 600;
var riff1 = "G M G R R G M G R R G G GGG M G R R G M G R R G G GG";
var riff2 = "G M G R L L L L L LLLLRLLLLLLLG M G R L L L L L LLLLRLG G GG";
var track = riff1 + riff2 + riff2 + riff1;
/** HERE BE DRONES */
var $window = $(window);
var index = 0;
track = track.split("");
var playNext = function() {
var char = track.shift().charCodeAt(0);
if (char != 32) {
try {
$window.trigger(jQuery.Event('keydown', { which: char, keyCode: char }));
} catch(e) {}
}
if (track.length) {
setTimeout(playNext, 60000 / bpm);
}
};
playNext();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment