New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

midimessage

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

midimessage

Web-MIDI Message Parser

latest
Source
npmnpm
Version
1.0.5
Version published
Weekly downloads
5.2K
-6.27%
Maintainers
1
Weekly downloads
 
Created
Source

midimessage

npm version

Simple MIDI Message Parser for JavaScript. This parser takes in a MIDIMessageEvent and returns a plain Javascript Object with propties indicating the data in the MIDI message.

Installation

npm install midimessage

Usage

var MIDIMessage = require('midimessage');

midiInput.onmidimessage = function(event){
	var midiMessage = MIDIMessage(event);
	console.log("Parsed", midiMessage);
}

API

MIDIMessage : Function - Takes a MIDIMessageEvent as the only argument and decodes the data in the MIDIMessageEvent. Returns a MIDIMessage Object which has various properties set to values based on the MIDIMessage.

These properties are based off the MIDI Message Standard as defined in the MIDI Spec

These are some of the properties that may be exposed (based on the incoming MIDI message) :

  • channel: Number (0-127) - MIDI Channel Number.
  • messageType: String - Type of message. Possible values defined below.
  • key: Number (0-127) - The key (note) number. Defined on -noteon,noteoff,keypressure messages.
  • velocity: Number (0-127) - Velocity. Defined on noteon,noteoff messages.
  • controllerNumber: Number (0-127) - Controller Number. Controller numbers 120-127 are reserved as "Channel Mode Messages".
  • controllerValue: Number (0-127) Controller Value. Has various meanings based on controllerNumber.
  • channelModeMessage: String - Channel Mode Message. Specific messages for Channel Modes based on controllerNumber. Possible values defined below.
  • pressure: Number (0-127) - Pressure value.
  • pitchBend: Number (0-16383) - Pitch Bend value. Center (no pitch change) is 8192.

Possible values of messageType property.

[
'noteon', // Note On event.
'noteoff', // Note Off event.
'keypressure', // Polyphonic Key Pressure (Aftertouch).
'controlchange', // Control Change.
'programchange', // Program Change.
'channelpressure', // Channel Pressure (After-touch).
'pitchbendchange', // Pitch Bend Change.
]

Possible values of channelModeMessage property.

[
'allsoundoff', // All Sound Off.
'resetallcontrollers', // Reset All Controllers.
'localcontroloff', // Local Control Off.
'localcontrolon', // Local Control On.
'allnotesoff', // All Notes Off.
'omnimodeoff', // Omni Mode Off.
'omnimodeon', // Omni Mode On.
'monomodeon', // Mono Mode On (Poly Off).
'polymodeon' // Poly Mode On (Mono Off)
]

License

MIT

See License file

Keywords

midi

FAQs

Package last updated on 08 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts