Grants access to midi devices via native libraries or WebMIDI.
❗Currently NO iOS support. Because I don't have access to a Mac. Contributors Welcome❗
npm install capacitor-midi
npx cap sync
Open device and subscribe to MidiMessages
const options : DeviceOptions = {
deviceNumber : 0 // Choose device from listMIDIDevices()
}
this . devices = await MIDI . listMIDIDevices ( ) ;
MIDI . addListener ( 'MIDI_MSG_EVENT' , ( message : MidiMessage ) => {
console . log ( message ) ;
} ) ;
Subscribe to device connection changes
await MIDI . initConnectionListener ( ) ;
MIDI . addListener ( 'MIDI_CON_EVENT' , ( devices : { value : string [ ] } ) => {
console . log ( devices . value ) ;
} ) ;
listMIDIDevices ( ) = > Promise < { value : string [ ] ; } >
Returns: Promise<{ value: {}; }>
openDevice ( options : DeviceOptions ) = > Promise < void >
initConnectionListener ( ) = > Promise < void >
addListener ( eventName : 'MIDI_MSG_EVENT' , listenerFunc : ( message : MidiMessage ) = > void ) => Promise < PluginListenerHandle >
Param
Type
eventName
"MIDI_MSG_EVENT"
listenerFunc
(message: MidiMessage ) => void
Returns: Promise<PluginListenerHandle >
addListener ( eventName : 'MIDI_CON_EVENT' , listenerFunc : ( devices : { value : string [ ] ; } ) = > void ) => Promise < PluginListenerHandle >
Param
Type
eventName
"MIDI_CON_EVENT"
listenerFunc
(devices: { value: {}; }) => void
Returns: Promise<PluginListenerHandle >
Prop
Type
deviceNumber
number
Prop
Type
remove
() => Promise<void>
Prop
Type
type
string
note
number
velocity
number