How to add Midi musics in your application in 3 steps.
If you already have a project with MPTK V1, please follows this tutorial to migrate from V1 to V2.
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. You can delete all the Midi files and add your favorites (see Midi Player Tool Kit Setup below).
Tips : Pro version comes with no SoundFont and no Midi file. 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.
Recommendations: to ease installation of futures updates of MPTK (a lot of great functions are forecasted!), try to follows these rules:
- Create your assets apart of the MPTK assets.
- Don’t change anything in MPTK scripts or hierarchy.
- Use only documented API.
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.
But if you have migrated from V1, SoundFont must be re-imported because the format is totally different.
2.1 – Add to your Unity hierarchy, one or more “MidiFilePlayer” Prefab from “Asset/MidiPlayer/Prefab”. Each one can plays 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 MidiFilePlayer Inspector
3.1 – Select one MidiFilePlayer in the hierarchy, then look at the Inspector:
3.2.1 – Select the Midi File to play. If no Midi is 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.