Skip to content

Instantly share code, notes, and snippets.

@samhains
Created March 28, 2015 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samhains/3eaf0c888f815958f2b2 to your computer and use it in GitHub Desktop.
Save samhains/3eaf0c888f815958f2b2 to your computer and use it in GitHub Desktop.
function playNote(note, tempo){
setTimeout(function(){
synth.triggerAttackRelease(note+"4", 0.25);
}, tempo);
}
function Note(note,tempo){
this.note = note;
this.tempo = tempo;
}
var noteArr = [new Note('C4',1000), new Note('D4',1000), new Note('E4',1000) ];
noteArr.forEach(function(noteObj){
var note = noteObj.note;
var tempo = noteObj.tempo;
playNote(note,tempo);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment