MidiInReader is a Prefab, available with the Pro version, that can be used to read Midi events from your Midi keyboard connected to your computer. Moreover, without any scripting, you can play audio directly with the MPTK Synth. By script, you can process each Midi Events to do … what you want to do !
Only one MidiInReader is allowed by project. There is no sense to have more than one !
This prefab is build upon the class MidiKeyBoard. In fact use this class if you need also to send Midi messages to the device. The prefab MidiInReader is specialized to read Midi messages from a Midi device.
For connecting external Midi device, Unity needs a plugin in order to propose core functions as list, select, open devices, write or read Midi messages.
For MPTK version equal or after 2.85, download, unzip and import the packageMidiKeyboard:
For MPTK version before 2.85, download, unzip and import the package “MIDI Jack” from Keijiro Takahashi in your application:
- Available for Windows 10 64 bits and MacOs 10.1 and after
- Not available on Android and IOs.
- Not able to process Sysex messages (perhaps in the future if there is a need)
- Read Midi Events: Midi events from the keyboard are read.
- Log Midi Events: log information about events in console.
- Send To MPTK Synth: midi events are played in real time with the internal MPTK synth.
- On Event Input Midi: be notified when a new event is read from your keyboard. Trigger a method in your script and do … what you want to do !