Creates a new instrument instance for processing MPE data
: Object
Name | Description |
options.log
(default false )
|
Log instrument state to the console on change |
options.normalize
(default false )
|
For all notes, remap
timbre
,
noteOnVelocity
,
noteOffVelocity
and
pressure
between 0 and 1, remap
pitchBend
between -1 and 1
|
options.pitch
(default false )
|
Adds a
pitch
property to all notes:
uses scientific notation eg.
C4
when
true
or
'scientific'
, uses
Helmholtz notation eg.
c'
when set to
'helmholtz'
|
options.pitchBendRange
(default 48 )
|
Converts
pitchBend
to the
range specified, overriding
normalize
if both are set
|
Object
Instance representing an MPE compatible instrument
import mpeInstrument from 'mpe';
// Define `instrument` as an instance of `mpeInstrument`
const instrument = mpeInstrument();
// Request MIDI device access from the Web MIDI API
navigator.requestMIDIAccess().then(access => {
// Iterate over the list of inputs returned
access.inputs.forEach(midiInput => {
// Send 'midimessage' events to the mpe.js `instrument` instance
midiInput.addEventListener(
'midimessage',
(event) => instrument.processMidiMessage(event.data)
);
});
});