Namespace: CONTROLLER_EVENTS

CONTROLLER_EVENTS

Controller event constants. Events are organized by category and follow a consistent naming pattern: - Core events (READY, ERROR, DESTROYED) - Device events (DEV_*) - Channel events (CH_*) - System events (SYS_*) - Patch events (PATCH_*)
Properties:
Name Type Default Description
READY string "ready" Emitted when controller is initialized and ready
ERROR string "error" Emitted on errors
DESTROYED string "destroyed" Emitted when controller is destroyed
DEV_OUT_CONNECTED string "dev-out-connected" Emitted when output device is connected
DEV_OUT_DISCONNECTED string "dev-out-disconnected" Emitted when output device is disconnected
DEV_IN_CONNECTED string "dev-in-connected" Emitted when input device is connected
DEV_IN_DISCONNECTED string "dev-in-disconnected" Emitted when input device is disconnected
CH_CC_SEND string "ch-cc-send" Emitted when sending control change
CH_CC_RECV string "ch-cc-recv" Emitted when receiving control change
CH_NOTE_ON_SEND string "ch-note-on-send" Emitted when sending note on
CH_NOTE_ON_RECV string "ch-note-on-recv" Emitted when receiving note on
CH_NOTE_OFF_SEND string "ch-note-off-send" Emitted when sending note off
CH_NOTE_OFF_RECV string "ch-note-off-recv" Emitted when receiving note off
CH_PC_SEND string "ch-pc-send" Emitted when sending program change
CH_PC_RECV string "ch-pc-recv" Emitted when receiving program change
CH_PITCH_BEND_SEND string "ch-pitch-bend-send" Emitted when sending pitch bend
CH_PITCH_BEND_RECV string "ch-pitch-bend-recv" Emitted when receiving pitch bend
CH_MONO_PRESS_SEND string "ch-mono-press-send" Emitted when sending channel pressure
CH_MONO_PRESS_RECV string "ch-mono-press-recv" Emitted when receiving channel pressure
CH_POLY_PRESS_SEND string "ch-poly-press-send" Emitted when sending polyphonic pressure
CH_POLY_PRESS_RECV string "ch-poly-press-recv" Emitted when receiving polyphonic pressure
CH_ALL_SOUNDS_OFF_SEND string "ch-all-sounds-off-send" Emitted when sending all sounds off
CH_RESET_CONTROLLERS_SEND string "ch-reset-controllers-send" Emitted when sending reset all controllers
CH_LOCAL_CONTROL_SEND string "ch-local-control-send" Emitted when sending local control
CH_ALL_NOTES_OFF_SEND string "ch-all-notes-off-send" Emitted when sending all notes off
CH_OMNI_OFF_SEND string "ch-omni-off-send" Emitted when sending omni mode off
CH_OMNI_ON_SEND string "ch-omni-on-send" Emitted when sending omni mode on
CH_MONO_ON_SEND string "ch-mono-on-send" Emitted when sending mono mode on
CH_POLY_ON_SEND string "ch-poly-on-send" Emitted when sending poly mode on
SYS_EX_SEND string "sys-ex-send" Emitted when sending SysEx
SYS_EX_RECV string "sys-ex-recv" Emitted when receiving SysEx
SYS_CLOCK_RECV string "sys-clock-recv" Emitted when receiving MIDI clock
SYS_START_RECV string "sys-start-recv" Emitted when receiving start command
SYS_CONTINUE_RECV string "sys-continue-recv" Emitted when receiving continue command
SYS_STOP_RECV string "sys-stop-recv" Emitted when receiving stop command
SYS_MTC_RECV string "sys-mtc-recv" Emitted when receiving MTC
SYS_SONG_POS_RECV string "sys-song-pos-recv" Emitted when receiving song position
SYS_SONG_SEL_RECV string "sys-song-sel-recv" Emitted when receiving song selection
SYS_TUNE_REQ_RECV string "sys-tune-req-recv" Emitted when receiving tune request
SYS_ACT_SENSE_RECV string "sys-act-sense-recv" Emitted when receiving active sensing
SYS_RESET_RECV string "sys-reset-recv" Emitted when receiving system reset
MIDI_RAW string "midi-raw" Emitted for unhandled raw MIDI messages
PATCH_SAVED string "patch-saved" Emitted when a patch is saved
PATCH_LOADED string "patch-loaded" Emitted when a patch is loaded
PATCH_DELETED string "patch-deleted" Emitted when a patch is deleted
Source:

Examples

// Listen for controller ready
midi.on(CONTROLLER_EVENTS.READY, (controller) => {
  console.log("MIDI ready!");
});
// Listen for CC messages (both send and receive)
midi.on(CONTROLLER_EVENTS.CH_CC_SEND, ({ cc, value, channel }) => {
  console.log(`Sent CC ${cc}: ${value} on channel ${channel}`);
});

midi.on(CONTROLLER_EVENTS.CH_CC_RECV, ({ cc, value, channel }) => {
  console.log(`Received CC ${cc}: ${value} on channel ${channel}`);
});
// Listen for device connections
midi.on(CONTROLLER_EVENTS.DEV_OUT_CONNECTED, (device) => {
  console.log(`Output connected: ${device.name}`);
});
// Using the short alias (CTRL)
midi.on(CTRL.READY, (controller) => {
  console.log("MIDI ready!");
});