@mohayonao/midi-keyboard

JavaScript utility for MIDI keyboard

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
110Jul 6, 2015Jul 1, 2015Minified + gzip package size for @mohayonao/midi-keyboard in KB

Readme

MIDI KEYBOARD

Build Status NPM Version License

JavaScript utility for MIDI keyboard

Keystation Mini 32

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 - 15
    • value: 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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.