MusIT

Prefab MidiListPlayer

MidiListPlayer is a Prefab, available with the Pro version, able to play Midi music from a list of Midi from your MPTK database in Unity.

Furthermore, you can play part of a Midi files, overlap, loop.

  • This Prefab is available with MPTK Pro.
  • No line of script is necessary to use this Prefab.
  • An API exists for a more complex integration in your application.
  • See an example with source code at the end of this page.

Inspector parameters

Overlap time in milliseconds of overlap between two Midi. The end of the current Midi gently overlaps the start of the next Midi.

Play On Start if checked, start playing when your application start.

Loop on the List if checked, restart playing automatically at the first when the end of the Midi list is reached.

Add a new entry to the list
Remove the selected entry
Move Up the selected entry
Move Down the selected entry

When running:

Integrated MidiFilePlayer

In the MidiListPlayer, select MidiFilePlayer_1, the classical MidiFilePlayer Inspector is displayed.

See here for the description of each attributes and folders.

Integration of MidiListPlayer in your script

See TestMidiListPlayer.cs and events associated in the canvas gameobjects of TestListMidiPlay scene for the whole example.

using MidiPlayerTK;
...
// MPTK component able to play a Midi list. 
// This PreFab must be present in your scene.
/// </summary>
public MidiListPlayer midiListPlayer;
...
private void Start()
{
   if (!HelperDemo.CheckSFExists()) return;
 // Find the Midi external component 
    if (midiListPlayer == null)
    {
       Debug.Log("No MidiListPlayer defined with the editor inspector, try to find one");
       MidiListPlayer fp = FindObjectOfType<MidiListPlayer>();
       if (fp == null)
          Debug.Log("Can't find a MidiListPlayer in the Hierarchy. No music will be played");
       else
          midiListPlayer = fp;
}

// This method is fired from button
public void Next()
{
   midiListPlayer.MPTK_Next();
}

Get MPTK from the Unity store

If you like Midi Player Tool Kit, please leave a review on the Asset Store. It’s very appreciated!!!

Maestro MPTK on ChatGPT!

From different MPTK documentation sources DarkSky42 has created a custom LLM based on ChatGPT. You are now able to ask all the questions you want and get a good level of response, request code example, verify your source code …

Contact

If you have questions, please don’t hesitate to contact us via the dedicated Unity forum or our Discord  channel.

Reach the Discord archive by topic.

We are always happy to discuss your projects!

Add MIDI Music With 3 Clicks for Free

Sound Spatialisation, MPTK is ready for Virtual Reality [Pro]

Sound Spatialisation, MPTK is ready for Virtual Reality [free]

Midi Synth : Real Time Voice Effect Change

Euclidean Rhythm demo

The Deezer playlist that helped me create Maestro