Skip to content

Instantly share code, notes, and snippets.

@joshstovall
Created September 10, 2021 07:45
Show Gist options
  • Save joshstovall/09a75cc696618258df08a2fe5afdfdf6 to your computer and use it in GitHub Desktop.
Save joshstovall/09a75cc696618258df08a2fe5afdfdf6 to your computer and use it in GitHub Desktop.
midi.js
// pianos
var leftMIDI = JZZ.input.Kbd({at:'leftMIDI' , from:'C5', to:'B5', onCreate:function() {}});
var rightMIDI = JZZ.input.Kbd({at:'rightMIDI', from:'C5', to:'B5', onCreate:function() {}});
var synth = JZZ.synth.Tiny();
rightMIDI.connect(synth);
leftMIDI.connect(synth);
// midi out
var midi_out = JZZ.gui.SelectMidiOut({ at: 'midi_out' });
rightMIDI.connect(midi_out);
leftMIDI.connect(midi_out);
checkbox.addEventListener('change', function() {
if (this.checked) {
rightMIDI.disconnect(synth);
leftMIDI.disconnect(synth);
} else {
rightMIDI.connect(synth);
leftMIDI.connect(synth);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment