Skip to content

EventEmitter.ANY_EVENT #234

Answered by djipco
mike-shields-dev asked this question in Q&A
Jan 30, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

There is currently no way to listen to all MIDI messages globally. You could, however, add a listener for midimessage to all Input or InputChannel objects.

This is how to do it at the Input level:

WebMidi.inputs.forEach(input => {
  input.addListener("midimessage", e => console.log(e));
});

The difference between listening for midimessage and listening for EventEmitter.ANY_EVENT is that the former is only triggered when a MIDI message is received while the latter is triggered by MIDI messages and other events such as opened, closed and disconnected.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mike-shields-dev
Comment options

@elmcapp
Comment options

Answer selected by mike-shields-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants