The Midi File Player is the Prefab that you can use to play a Midi files in your application. See Quick Start to understand how add a Midi File Player in your application.
Check the Midi File Player Inspector, these parameters are available:
- Play At Startup if checked, start playing when your application start.
- Direct Send To Player if not checked, Midi file is read but no note are played. Must be checked to get some music !
- Pause with distance if checked, automatically pause playing if distance between the gameobject MidiFilePlayer and the AudioListener is greater than MaxDistance.
- MaxDistance distance for the pause with distance function.
- Loop if checked, restart playing automatically at end of the Midi file.
- Speed speed to play the Midi file. with 1 play at the tempo defined in the Midi file.
- Transpose transpose the music by half tone.
- Release Time a sound is never brutally stop at end of time, a release time (0.1 second by default) is add to smoothly stop the sound.
- Log Waves display a log for each waves selected for each notes.
- Show Midi Parameters
- Quantization define quantization to remove some imprecision in tempo. With quantization, notes are plays on beats or on fractions of beats.
- Enable Temp Change if checked, tempo change from the Midi are used.
- Enable Pan Change if checked, panomarics (left/right) change from the Midi are used. Don’t check if left/right is managed by your appliction.
- Keep Notes Off notes off are not used to play the Midi (duration is used). If you have the need to get Note Off (for example to write a consistent Midi file, check this option).
- Log Midi Events check to have a log for each Midi events when playing.
- Show Events set events to trigger actions in your scripts a:
- OnEventStartPlayMidi: start playing the Midi file.
- OnEventNotesMidi: each time when a group of notes are to be played
- OnEventEndPlayMidi: end playing the Midi file
Midi File Player Inspector in Run Mode get new fields:
- Play / Pause / Stop / Restart, change the current playing status.
- Position current position of the playing Midi and total length. The slider can be used to change this position when playing.