This is a very simple web midi api wrapper.
<script src="js/poormidi.js"></script>
var midi = new poormidi();
midi.setHandler(onMIDIEvent);
function onMIDIEvent(e){
var message = e.data[0] & 0xf0;
if(message === 0x90){ // Note ON?
// anything!
}
}
// Note No.= 40, Velocity = 100
midi.sendNoteOn(40,100);
or
// MIDI ch.=1, Note No.= 40, Velocity = 100
midi.sendNoteOn(0, 40,100);
// Note No.= 40
midi.sendNoteOff(40);
// Control Number = 10, value = 100
midi.sendCtlChange(10,100);
That's all! Enjoy! :D
Creative Commons Attribution 4.0 2015-2022 by D.F.Mac.