Skip to main content

MPE Input

Connecting to device

To connect to the device, you need to instantiate new MPEMidivalInput class. Then you can wait for zone changes:

import { MIDIValInput } from "@midival/core"
import { MPEMidivalInput } from "@midival/core/mpe"

const mpeInput = new MPEMidivalInput(new MIDIValInput(input));
mpeInput.onLowerZoneUpdate(lowerZone => {
mpeInput.if (!lowerZone) {
console.log("Lower Zone was disabled");
return;
}

lowerZone.onNoteOn(note => {
console.log(`Note: ${note.note} Velocity: ${note.velocity}`)
})
})

Similarly you can interact with mesages on upperZone.