humanize-midimessage

1.1.1 • Public • Published

MIT npm

humanize-midimessage

MIDIMessageEvent is how your browser communicates signals from your MIDI devices. The event contains 3 bytes that correspond to various things in this table

That table isn't very readable by people like me so this library makes it readable by people like me.

Installation

$ npm install humanize-midimessage

Usage

In your HTML:

<script src="humanizeMidiMessage.js"></script>
<script>
    navigator.requestMIDIAccess()
    .then(function (midiAccess) {
        midiAccess.inputs.forEach(function (port, key) {
            port.onmidimessage = function (event) {
                console.log(humanizeMidiMessage(event));
            }
        });
    })
</script> 

API

humanizeMidiMessageEvent(MIDIMessageEvent)

Takes a MIDIMessageEvent and returns a humanized object with this shape:

{
    raw: [128, 0, 77],
    type: "Note On",
    note: 0,
    letter: "C",
    octave: 0,
    velocity: 0.30708661417322836
}

Example

example

Browser Support

Chrome

Status

Hidden behind the Enable Web MIDI API (#enable-web-midi) flag in chrome://flags.

Firefox

Status

IE

Status

Readme

Keywords

Package Sidebar

Install

npm i humanize-midimessage

Weekly Downloads

1

Version

1.1.1

License

MIT

Last publish

Collaborators

  • dannyfritz