Created
January 19, 2016 22:04
-
-
Save serebrov/a90aaab533156a914e71 to your computer and use it in GitHub Desktop.
This file contains 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
guitar = new gsynth.GuitarSynth(); | |
// a slowly picked E Major Chord: | |
var notes = [ | |
{ str: 5, fret: 0, duration: 1000 }, | |
{ str: 4, fret: 0, duration: 250 }, | |
{ str: 3, fret: 0, duration: 250 }, | |
{ str: 2, fret: 0, duration: 250 }, | |
{ str: 1, fret: 0, duration: 250 }, | |
{ str: 0, fret: 0, duration: 250 } | |
]; | |
function play(notes) { | |
note = notes.shift(); | |
setTimeout(function() { | |
guitar.playNotes([{ str: note.str, fret: note.fret }]); | |
if (notes.length) { | |
play(notes); | |
} | |
}, note.duration); | |
} | |
play(notes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment