Skip to content

Instantly share code, notes, and snippets.

@Chryus
Last active August 6, 2016 15:48
Show Gist options
  • Save Chryus/c1a9dedea521f382d9e47270dcc2460c to your computer and use it in GitHub Desktop.
Save Chryus/c1a9dedea521f382d9e47270dcc2460c to your computer and use it in GitHub Desktop.
// Cape Fear Leitmotif
// 1. Using Safari, go to http://stuartmemo.com/synth/
// 2. Enable Web Inspector - To do so, enable the “Show Develop menu in menu bar” setting found in Safari's preferences
// under the Advanced pane. You can then access Web Inspector through the Develop menu that appears in the menubar,
// or by pressing Command-Option-I. (see http://ow.ly/Y2Ae302Zn1C)
// 3. Open console (press Command-Option-I)
// 4. Copy and paste the code below
// 5. Press enter
var spookyArpeggio = ['e5', 'B4', 'A#4', 'E4'];
var i = 0;
var counter = 0;
function capeFearLeitmotif () {
if (i > 0) {
keyboard.keyUp(spookyArpeggio[i-1]);
}
keyboard.keyDown(spookyArpeggio[i]);
i++;
counter++;
if (i < spookyArpeggio.length) {
setTimeout(capeFearLeitmotif, 950);
} else {
setTimeout(function(){
keyboard.keyUp(spookyArpeggio[i-1]);
if (counter < 40) {
i = 0;
if (counter % 4 == 0) {
capeFearLeitmotif();
}
}
}, 950)
}
}
setTimeout(capeFearLeitmotif, 950);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment