setInterval(function () { if(timer > 3){ note = 60; timer = 0; } var tNote = teo.note.fromKey(note); console.log("note on"); output.sendMessage([144, tNote.key() , 90]); console.log(tNote.key()); output.sendMessage([144, teo.interval(tNote, 'M3').key() , 90]); console.log(teo.interval(tNote, 'M3').key()); setTimeout(function() { console.log("note off"); output.sendMessage([176, 123, 0]); }, 100) if(note < 90) { note = teo.interval(tNote, 'M3').key(); } else { note = 60; } timer += 1; }, 150);
function getScale(root, scaleName){ if (scaleName){ var rootNote = typeof root === 'number' ? teoria.note.fromMIDI(root) : teoria.note(root) return rootNote.scale(scaleName).notes().map(getDegree) } else { return [] } }
constructor (note, duration, chordwill, placement) { if(note !== '') { this.note = new teoria.note(note); this.octave = note.match(/\d/)[0]-3; this.freq = this.note.fq(); } this.rules; this.coupleRules; this.duration = duration; this.position = placement; this.fieldOfView = []; this.lastPosition = this.position; }
function harrrhmony (frequency) { var note = teoria.note.fromFrequency(frequency); var scale = note.note.scale('mixolydian'); var harmony = { third: teoria.note(scale.get('third').coord), fifth: teoria.note(scale.get('fifth').coord) }; return { note: note, harmony: harmony } };
play(duration, start) { if(this.note) { piano.play(this.note.name() + this.octave, 0, duration); } }