I hacked this together after discovering that the MIDI support in Godot is not available on iOS. This plugin uses the CoreMIDI framework to receive MIDI events.
- Install
uv
from https://docs.astral.sh/uv/ - Install
xcode
and command line tools - Build godot headers by running
make godot-headers
- Run
make
- Copy
bin/godot_ios_midi.a
andsrc/godot_ios_midi.gdip
to your Godot project'sios/plugins
directory - Enable plugin on export
public override void _Ready()
{
if (Engine.HasSingleton("MidiIOS"))
{
var plugin = Engine.GetSingleton("MidiIOS");
plugin.Connect(
"midi_event",
Callable.From(
(Godot.Collections.Dictionary eventData) => OnMidiEvent(eventData)
)
);
}
}
public void OnMidiEvent(Godot.Collections.Dictionary eventData)
{
byte[] midiBytes = (byte[])eventData["data"];
var timestamp = (double)eventData["timestamp"];
GD.Print(
$"MIDI Event Received - Timestamp: {timestamp}, Data: {BitConverter.ToString(midiBytes)}
);
}