@mohayonao/midi-keyboard

0.2.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i @mohayonao/midi-keyboard

Weekly Downloads

0

Version

0.2.1

License

MIT

Last publish

Collaborators

  • mohayonao