/GodotMidi

A MIDI file importer for Godot 3.x

Primary LanguageC#MIT LicenseMIT

GodotMidi

A MIDI file importer for Godot 3.x

This plugin aims to make rythm game development and music syncing easier than ever before. Simply import a midi file like you would any other godot asset and it will get converted to an animation, this animation can then be paired with a "MidiManager" node that sends out signals every time a midi event is fired. This project is a work in progress and is lacking some features, so feel free to contribute any code or ideas over on the pull requests page.

image

GodotMidi makes it easy to sync midi files to their corresponding rendered audio, just add an audio stream to the auto-generated audio stream player (a child of MidiManager) and it will play when the midi file starts.

image

Installation

  1. Download the latest release over at https://github.com/nlaha/GodotMidi/releases

  2. Extract it to your res://addons/ folder such that GodotMidi.cs is located at res://addons/GodotMidi/GodotMidi.cs

  3. Enable the plugin in the godot project settings menu

Usage

  1. Import a midi file by adding it to your project folder

  2. Add a "MidiManager" node to your scene, it will automatically add an AnimationPlayer as well

NOTE: MidiManager must be under the root of your scene, do not put it as a child of any other node

image

  1. Select the animation player and click the animation button to load an animation resource into the player

image

  1. Browse to your midi file location, if the import worked correctly, it should be selectable as an animation resource just like a normal animation would.

image

  1. Have fun! The animation player should work just as a normal animation player would, each green dot corresponds to a MIDI event and a function call to NoteEventInput(...) in the MidiManager node.

Simply create a method in your script with the following signature:

void NoteEvent(int note, int data, MidiEventNote.NoteType type, int track)
{
}

Similarily in GDScript (not tested)

note_event(note, data, type, track):
  # my cool midi thing

Don't forget to link your function to the signal emitted by the MidiManager node!

Roadmap

  • Track names should display somehow in the animation window
  • Support entire MIDI specification (SMPTE division type, weird events, different file modes)
  • Marker support
  • Audio playback with synthesizer? (low priority)