Quick Start

Here you will see how to add Midi Musics in your Unity application in a few steps.

if you are starting a new project go to 1.1 bullet bellow.

if you are updating Midi Player ToolKit, some older classes will remain in the folders because Unity import won’t removed these files and you will get tricky issues. Consequently, please follow this steps:

  1. backup your project,
  2. remove the entire current version in the Unity Editor project panel. Which means: remove folder MidiPlayer.
  3. and go to 1.1 bullet below.

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. However, you can delete all the Midi files and add your favorites (see Midi Player Tool Kit Setup below) even with the free version 😉

SoundFont(R) is a registered trademark of E-mu Systems, Inc.

Tips : Pro version comes with no SoundFont and no Midi file. See why here. 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 facilitate installation of futures updates of MPTK, please follow these rules otherwise you will lost compatibility with the futures versions.

  1. Create your assets apart of the MidiPlayer assets folder.
  2. Don’t change anything in MPTK scripts or hierarchy.
  3. Don’t change anything in Prefab.
  4. Use only documented API.

2 – Hierarchy

If you already added Midi files and SoundFont in MPTK, you can continue with the actions below otherwise, have a look here how to  Add Midi files and  how to Add SoundFonts.

2.1 – Add to your Unity hierarchy, one or more “MidiFilePlayer” Prefab from “MidiPlayer/Prefab”. Each one can plays a different Midi file.

2.2 – Check that you have an AudioListener component somewhere in your hierarchy. This component is typically associated with the “Main Camera”.

Tips: Unless you are an expert of MPTK, never try to use directly MPTK source files as MidiFilePlayer.cs. Some components are required to play Midi Music. Always use Prefab!

3 – From the MidiFilePlayer Inspector

3.1 – Firstly, select one MidiFilePlayer in the hierarchy, then look at the Inspector.

3.2.1 – Secondly, select the Midi File to play. But, if no Midi is available, see How to add Midi file.

3.2.2 – Most importantly, check ​that “Play At Startup” and “Send To Synth” are selected (default value).

3.2.3 – It’s over! Now you can run your Unity application, the Midi begins to play!

After that, you can try to change some parameters in the inspector: play speed, transpose, add effects… See here to have a description of all parameters.