@mohayonao/midi-keyboard
v0.2.1
Published
JavaScript utility for MIDI keyboard
Downloads
3
Readme
MIDI KEYBOARD
JavaScript utility for MIDI keyboard
Installation
Node.js
npm install @mohayonao/midi-keyboard
Browser
Examples
Online examples (using Web MIDI API)
Run example with Node.js (using node-midi)
node examples/dump.js
API
MIDIKeyboard
constructor(deviceName: string = 'Keystation Mini 32')
Class methods
requestDeviceNames(): Promise<{ inputs: string[], outputs: string[] }>
Instance methods
Also implements methods from the interface @mohayonao/event-emitter.
open(): Promise<[ input, output ]>
close(): Promise<[ input, output ]>
Events
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 )
Usage
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);
});
License
MIT