MIDI Engine : Core

Cross Platform Midi File Parser And Importer For Unreal Engine Projects

Unreal Engine Midi File Importer

MidiEngine is a plugin for  Unreal Engine 5 that adds functionality to import Midi files into unreal engine 5 as UObjects. It will import .mid files as UMidiAssets which is a custom data type to represent MIDI files within unreal engine. 

After Importing, you can access and query the UMidiAsset for MidiTracks(Instruments) and their respective MidiNotes.

This is the first plugin that introduces you to the Midi Engine Framework and we have made this plugin completely free. If you like Midi Engine Core, then you will definitely love MidiEngine Broadcasters.

MIDI Asset File Structure

MidiEngine MidiAsset Details

The Midi File Importer takes in and packs .Midi file data into a highly optimized Unreal engine 5 compatible asset called a UMidiAsset.

The MidiAsset Structure is carefully structured, with MidiTracks containing their respective Midi Notes.
For Example, The “Piano” Track will only contain the MidiNotes from the Piano. The Kick Track will only contain midi notes from the piano.

Useful Blueprint Functions

There is a lot of nice blueprint functions you can call to reach your goal. Although you can also dive into C++ and call functions, it won’t be needed 95% of the time because every important function is callable from Blueprints.

Get All Midi Notes From A Specific Midi Track

The “Get Midi Track” Function takes in a String. This string is your Midi Track Name, Example “Piano” or “Kick“.
It will return a UMidiTrack object.

Once you have the Midi Track Object, you can call the “Get Midi Notes As Array” function which will return ALL the midi notes within that MidiTrack.

You can access and query all Midi Tracks from a Midi File in unreal engine 5 using this method.

Accessing A Midi Note's Properties

We’ve now seen that a MidiAsset contains  MidiTracks, which then contain MidiNotes
So MidiAsset –> MidiTrack –> MidiNote.
1. From a Midi Note Object reference just get the “Note Properties” structure and break it.
2. Once you do this you get access to  the following information about a midi note:

  • Pitch Number (eg 60).
  • Pitch Name (eg C5).
  • Start Time (time is seconds the note turns ON).
  • Duration (how long does the midi note play for, in seconds)
  • Stop Time ( time in secconds when the note stops playing)
  • Velocity ( how loud is the note).

A lot of ue5 uobjects can use this MIDI note data in different ways. Its upto you to do whatever you want to do after importing a MIDI file in unreal engine using this plugin.

Getting the BPM (Beats Per Minute)

BPM Curve Unreal Engine 5

Sometimes you may need the Beats Per Minute Information from a Midi File or Midi Asset. 

BPM on a midi file can change while a midi file is playing. For example in the beginning of a song it can be 60BPM and during the chorus it can be 80BPM. 
The MidiAsset contains all BPM information in a specialized curve that you can view in the editor or query from blueprints.

Get The BPM Midi Asset Unreal engine

You can call the “Get BPM” function on a MidiAsset object from Blueprints to query BPM information.

It Takes in time in seconds. So if you pass in 0 seconds. you’re trying to get the BPM at 0 seconds.
If you pass in 50 seconds, you’re trying to get the BPM at 50 seconds.

Time signature

The Midi importer stores information like time signature so that you can use it if need be.

You can easily get the the denominator and numerator. 
Eg a song is in 4/4 , or 3/4 etc. That information is available.

Project Settings : Middle C

As musicians and producers, we each have our unique experiences with various Digital Audio Workstations (DAWs), each of which interprets MIDI data in its own way.

Take MIDI Note 60 as an example. In FL Studio, this is labeled as “C5“. In contrast, Ableton Live might label it “C4” or even “C3“.

This can understandably cause confusion when you import your MIDI file and find your notes labeled as “C5” when you expected “C3“.

The root of this variation lies in how each DAW interprets the note 60, often referred to as middle C.

To make this transition smoother for you, we’ve introduced a plugin setting. Simply adjust the “Middle C” option to match the pitch name from your preferred DAW.

Rest assured, the note remains at pitch “60”. Only the label changes, not the pitch itself.

So, it’s merely a change in pitch designation, not its actual tone.

Other Functions

There are other functions and properties you can access but the above should cover the most use cases.
Eg you can also call get duration on the MidiAsset to get the entire duration of the midi asset in seconds.

Getting MidiEngine Core

Download MidiEngine Core from the Unreal Engine Marketplace Today  and start your rhythm game and audio visualization journey!

Download Product From The Unreal Engine Marketplace

Play Video
Current Version:
Supported Engine Versions:
Supported Platforms