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
const options: DeviceOptions = {
deviceNumber: 0 // Choose device from listMIDIDevices()
}
this.devices = await MIDI.listMIDIDevices();
MIDI.addListener('MIDI_MSG_EVENT', (message: MidiMessage) => {
console.log(message);
});
await MIDI.initConnectionListener();
MIDI.addListener('MIDI_CON_EVENT', (devices: { value: string[] }) => {
console.log(devices.value);
});
listMIDIDevices()
openDevice(...)
initConnectionListener()
addListener(...)
addListener(...)
- Interfaces
listMIDIDevices() => Promise<{ value: string[]; }>
Returns: Promise<{ value: {}; }>
openDevice(options: DeviceOptions) => Promise<void>
Param | Type |
---|---|
options |
DeviceOptions |
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 |