JavaScript utility for MIDI keyboard
Node.js
npm install @mohayonao/midi-keyboard
Browser
Online examples (using Web MIDI API)
Run example with Node.js (using node-midi)
node examples/dump.js
constructor(deviceName: string = 'Keystation Mini 32')
requestDeviceNames(): Promise<{ inputs: string[], outputs: string[] }>
Also implements methods from the interface @mohayonao/event-emitter.
open(): Promise<[ input, output ]>
close(): Promise<[ input, output ]>
message
dataType: string
- noteOn
- noteOff
- modulation
- volume
- pan
- expression
- sustain
- pitchbend
deviceName: string
channel: number
0 - 15value: number
0 - 127 ( control change )noteNumber: number
0 - 127 ( noteOn / noteOff )velocity: number
0 - 127 ( noteOn / noteOff )
Node.js
var MIDIKeyboard = require("@mohayonao/midi-keyboard");
Browser
<script src="/path/to/midi-keyboard.js"></script>
Common
var midiKey = new MIDIKeyboard("Keystation Mini 32");
midiKey.open();
midiKey.on("message", function(e) {
console.log("dataType : " + e.dataType);
console.log("noteNumber: " + e.noteNumber);
console.log("velocity : " + e.velocity);
console.log("value : " + e.value);
console.log("channel : " + e.channel);
});
MIT