1.2.0 • Published 4 years ago

midy v1.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Midy

GitHub CI Status Code Coverage bundle size npm version

A super-minimalistic MIDI library.

Installation

yarn add midy
# or using npm
npm i midy

Example

import Midy from 'midy';

const midy = new Midy();
if (await midy.requestAccess()) {
	midy.on('noteDown', (note, channel, velocity) => {
		console.log('A key was pressed!', note, channel, velocity);
	});
}

Methods

Method nameParametersDescriptionType
requestAccessnoneRequest access to the Web MIDI API.Promise<boolean>
onevent name string, listener functionRegister an event listener. See Houk APIvoid
offevent name string, listener functionUnregister an event listener. See Houk APIboolean

Events

Event nameDescriptionParameters
noteUpTriggered once a key is released.MIDI note number, MIDI channel number, velocity number
noteDownTriggered once a key is pressed.MIDI note number, MIDI channel number, velocity number
midiMessageRaw MIDI events.MIDI event MIDIMessageEvent

Properties

Property nameDescriptionType
accessMIDI accessMIDIAccess
inputsMIDI inputsMIDIInputMap
outputsMIDI outputsMIDIOutputMap
stateAccess state'none' | 'pending' | 'granted' | 'denied'