How to add Midi music in your application in 3 steps.
1- Project
1.1 – Download Free Midi Player Tool Kit or download Pro Midi Player Tool Kit .
1.2 – Import Unity package in your Unity application, you will get something like this in your project:
Tips : Free version comes with a default SoundFont (GeneralUser_GS_SoftSynth_v144) and some examples of midi files. Of course you can delete all Midi files and add your favorites (see Midi Player Tool Kit Setup below).
Tips : Pro version comes with no SoundFont and no Midi files. See why here. Please, have a look to theses pages to understand How to add Midi file and How to add SoundFonts before beginning this quick start.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.
2 – Hierarchy
If you already added Midi files and SoundFont in MPTK, you can continue with the actions below else have a look here for how to Add Midi files and for how to Add SoundFonts.
2.1 – Add to your Unity hierarchy, one or more “MidiFilePlayer” Prefab from “Asset/MidiPlayer/Prefab”. Each one can play a different Midi file.
2.2 – Check that you have an AudioListener component somewhere in your hierarchy, typically associated with the “Main Camera”.
3 – From the Midi File Player Inspector
3.1 – Select one MidiFilePlayer in the hierarchy, then have a look to the Inspector:
3.2.1 – Select the Midi File to play. If no Midi are available, see How to add Midi file.
3.2.2 – Check ”Play On Start”.
3.2.3 – It’s over! Run your Unity application, the Midi begins to play!
Play with the parameters available or go here to have a description of all parameters.