Download

Need help using MIDI plugin

Hi everyone, I’m new to unreal for just a couple of months and I’m trying to develop a prototype where the application plays a melody (I’d like to specify the notes in code) in each level, but for design issues I cannot use audio files (I need to specify the notes dinamicaly), so I saw that the MIDI plugin could be an option but I have some cuestions firstly, I hope the community can help me.

Is this library able to play notes of different duration?
How can I use it correctly?
Can I use a sound similar to Piano?

Thanks for your help!! :slight_smile:

The MIDI Device Input plug-in is support for Device interaction, so you can use a MIDI keyboard, for example, to control gameplay events.

As far as playing notes, you can create your own custom Enums and Structs. I have used this before to create my own note data to read from an array of notes.

AFAIK: MIDI defines events like note on and note off. So the question is not can the library play different lengths but can you create and send MIDI events at different times :wink:

MIDI alone won’t give you a sound, it’s just a protocol to send/save notes. So you would need to create additional code/blueprints that plays a piano sound based on the MIDI events.

@dan.reynolds thanks for the tips : ) I was wondering how I might store and call a melody as a list of notes since (as far as I know) the current Epic midi implementation doesn’t support midi files. Just asking in case: do you by chance have any example code (or could point to any) that demonstrates an array of notes that we could call in cpp to trigger any of the recently released synths? (could also be blueprints, but personally i’m digging into cpp lately).

@ardin97 the sound source you choose is up to you. Midi itself doesn’t generate sound, but it is often used to speak to a sound generating source by specifying parameters like what note to play, how long or short that note is based on note on and off messages as well as to set certain parameters of the sound generating source using midi’s CC messages. Re: your question on how to use it properly… That’s a difficult one to answer. If you get it working, there is no wrong way. I’d suggest reading up on how midi works and what its limitations are because Epic’s implementation of midi is the same as any applications.

I don’t know if you are still looking for this, but there is a code plugin on the Unreal Marketplace that adds more MIDI functionality to the Engine: Procedural Midi in Code Plugins - UE Marketplace. I was able to find a number of different uses for it. PM me if you’d like more information.

For the GDC 2017 announcement of the Unreal Audio Engine, I created a MIDI reader in Blueprints for this demo (time 36:50):
https://youtube.com/watch?v=ErejaBCicds

Using a MIDI to CSV converter, I converted MIDI files to CSV files, cleaned up the data I didn’t want from the table using Excel.

Then I created a custom Blueprint Struct (conformed to the CSV layout) that had all the relevant MIDI Data. From that Struct, I was able to create a Data Table based off that type. Then I created a Blueprint for reading off the Data Table entries in order and used my BP MIDI Interface (from the sticky) to send out MIDI-style Messages to our Modular Synthesizer.

2 Likes

Hey Dan - playing back midi notes developed in an external DAW seems like a really important thing to have, have you all thought about expanding this work you did for the demo?

I could think of a few things that would be cool…

1 - VSTs of the unreal synths, so you could get the particular sound you are looking for in one’s particular favorite DAW
2 - the ability to save presets of these synths and export them to unreal so they match
3 - the ability to load midi notes which would animate specific parameters in time, cue’d by gameplay events
4 - Having gameplay also affect specific aspects of these parameters via BP.

Just some thoughts, I would love to hear how one might be able to do this today, or if it’s in the cards for the future!
-a

@andyfedak For 3,4 I am developing a plugin that does just that… PM with email so that I can add you to mailing list for release announcement

It’s important to understand a couple of key differences between your DAW and Unreal:

Unreal is a tool for creating software.

Your DAW is a tool for creating assets.

You could not legally include your favorite VSTs in an Unreal project because you would be redistributing the VST to your users. This would require a special license from the VST manufacturer.

We added MIDI Output support a while ago, so you should be able to output from Unreal into your DAW via some intermediary loopback app.