Skip to content

Instantly share code, notes, and snippets.

@serebrov
Created January 19, 2016 22:04
Show Gist options
  • Save serebrov/a90aaab533156a914e71 to your computer and use it in GitHub Desktop.
Save serebrov/a90aaab533156a914e71 to your computer and use it in GitHub Desktop.
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