0.0.16 • Published 1 year ago

capacitor-midi v0.0.16

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

🎹 capacitor-midi

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❗

🔌 Install

npm install capacitor-midi
npx cap sync

🎼 Usage

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);
});

🎛 API

listMIDIDevices()

listMIDIDevices() => Promise<{ value: string[]; }>

Returns: Promise<{ value: {}; }>


openDevice(...)

openDevice(options: DeviceOptions) => Promise<void>
ParamType
optionsDeviceOptions

initConnectionListener()

initConnectionListener() => Promise<void>

addListener(...)

addListener(eventName: 'MIDI_MSG_EVENT', listenerFunc: (message: MidiMessage) => void) => Promise<PluginListenerHandle>
ParamType
eventName"MIDI_MSG_EVENT"
listenerFunc(message: MidiMessage) => void

Returns: Promise<PluginListenerHandle>


addListener(...)

addListener(eventName: 'MIDI_CON_EVENT', listenerFunc: (devices: { value: string[]; }) => void) => Promise<PluginListenerHandle>
ParamType
eventName"MIDI_CON_EVENT"
listenerFunc(devices: { value: {}; }) => void

Returns: Promise<PluginListenerHandle>


Interfaces

DeviceOptions

PropType
deviceNumbernumber

PluginListenerHandle

PropType
remove() => Promise<void>

MidiMessage

PropType
typestring
notenumber
velocitynumber
0.0.16

1 year ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago