useMidi is a low-level custom ReactHook to access the Web MIDI API. It provides access to incoming MIDIMessageEvents and helpers to request and observe the user's permission.
If set to true, useMidi will automatically ask for the user's permission to access the MIDI devices, instead of waiting for the consumer to call requestAccess.
false
callback
(midiMessage: MidiMessage) => void
If provided, the callback will be called on every received MidiMessage.
undefined
messagesHistoryCount
number
midiMessages will always contain the last messagesHistoryCount elements.
256
debug
boolean
If set to true, useMidi will log every event to the console.
false
suppressActiveSensing
boolean
If set to true, useMidi will ignore the Active Sensing event.
true
sysex
boolean
If set to true, useMidi use the sysex option when requesting MIDI access.
false
Returns
Index
Variable
Type
Description
Default
0
midiMessages
MidiMessage[]
An array of all MidiMessages, from oldest (index 0) to newest.