Skip to main content

MIDI Config

React UseMidi offers different config to configure the MIDI.

Shared Shared config

ConfigDefaultDescription
enabledtrueTrue when the Midi is active
sysexfalseTrue when use the sysex option requesting MIDI access
debugfalseTrue when use debug mode
targetnullRaw Midi Event Object
device'pointer'Select MIDI Device Key
port'default'Select input and output port key
input'default'Select input port key
output'default'Select output port key
datanullDefault number of delay time stamp when send.
delaynullDefault number of delay time stamp when send.
commandnullDefault number of recieved Midi command code.
channelnullDefault number of recieved Midi channel number.
notenullDefault number of Midi note number if recieved.
argsnullDefault arguments when you bind.

MIDI config

ConfigDefaultDescription
enabletrueTrue when the Midi is active

Structure of the config object

Depending on whether you suse midi hooks or if you use the useMidi hook, you will need to structure the config object differently.

useFade(state => {}, {...sharedConfig, ...fadeConfig})

useMidi({fade: state => {}}, {...sharedConfig, fade: fadeConfig})

Binding special config

You can override config using first argument of bind.

const bind = useNote(() => {}, {channel: 0, note: 0})

return (
<>
It is written using shorthands.
<button {...bind(() => 1)} />
<button {...bind(() => [1])} />
<button {...bind(() => [1, 1])} />
It means the same.
<button {...bind(() => ({note: 1}))} />
<button {...bind(() => ({channel: 1}))} />
<button {...bind(() => ({channel: 1, note: 1}))} />
</>
)