MidiPlayerTK.MidiExternalPlayer

Play a Local MIDI file or from a Web site. This class must be used with the prefab MidiExternalPlayer
More...

Inheritance diagram for MidiPlayerTK.MidiExternalPlayer:
MidiPlayerTK.MidiFilePlayer MidiPlayerTK.MidiSynth MidiPlayerTK.MidiSynth

Public Member Functions

override void MPTK_Play (bool alreadyLoaded=false)
 Play the midi file defined with MPTK_MidiName or MPTK_MidiIndex. More...
 
- Public Member Functions inherited from MidiPlayerTK.MidiFilePlayer
MidiLoad MPTK_Load ()
 
void MPTK_Next ()
 
MPTKEvent.EnumLength MPTK_NoteLength (MPTKEvent note)
 
void MPTK_Pause (float timeToPauseMS=-1f)
 
virtual void MPTK_Play (bool alreadyLoaded=false)
 
void MPTK_Play (byte[] data)
 
virtual void MPTK_Play (float delayRampUp, float startDelay=0)
 
void MPTK_Play (MidiFileWriter2 mfw2, float delayRampUp=0f, float fromPosition=0, float toPosition=0, long fromTick=0, long toTick=0, bool timePosition=true)
 
void MPTK_PlayNextOrPrevious (int offset)
 
bool MPTK_PreLoad (string uri)
 
void MPTK_Previous ()
 
List< MPTKEventMPTK_ReadMidiEvents (long fromTicks=0, long toTicks=long.MaxValue)
 
void MPTK_RePlay ()
 
bool MPTK_SearchMidiToPlay (string name)
 
void MPTK_SortEvents ()
 
void MPTK_Stop (bool stopAllSound=true)
 
virtual void MPTK_Stop (float delayRampDown, float stopDelay=0)
 
void MPTK_SwitchMidiWithDelay (int index, string name, float volume, float delayToStopMillisecond, float delayToStartMillisecond)
 
void MPTK_UnPause ()
 
- Public Member Functions inherited from MidiPlayerTK.MidiSynth
int MPTK_ChannelBankGetIndex (int channel)
 
int MPTK_ChannelControllerGet (int channel, int controller)
 
int MPTK_ChannelCount ()
 
bool MPTK_ChannelEnableGet (int channel)
 
void MPTK_ChannelEnableSet (int channel, bool enable)
 
int MPTK_ChannelForcedPresetGet (int channel)
 
bool MPTK_ChannelForcedPresetSet (int channel, int preset, int bank=-1)
 
string MPTK_ChannelInfo (int channel)
 
int MPTK_ChannelNoteCount (int channel)
 
bool MPTK_ChannelPresetChange (int channel, int preset, int bank=-1)
 
int MPTK_ChannelPresetGetIndex (int channel)
 
string MPTK_ChannelPresetGetName (int channel)
 
float MPTK_ChannelVolumeGet (int channel)
 
void MPTK_ChannelVolumeSet (int channel, float volume)
 
void MPTK_ChorusSetDefault ()
 
void MPTK_ClearAllSound (bool destroyAudioSource=false, int _idSession=-1)
 
void MPTK_InitSynth (int channelCount=16, bool resetActiveVoices=false)
 
void MPTK_ResetStat ()
 
void MPTK_ReverbSetDefault ()
 
void MPTK_SFChorusSetDefault ()
 
void MPTK_SFFilterSetDefault ()
 
void MPTK_SFReverbSetDefault ()
 
void MPTK_StartSequencerMidi ()
 
void MPTK_StopSynth ()
 
IEnumerator MPTK_WaitAllNotesOff (int _idSession=-1)
 
delegate void OnAudioFrameStartHandler (double synthTime)
 

Properties

new string MPTK_MidiName [get, set]
 
- Properties inherited from MidiPlayerTK.MidiFilePlayer
string MPTK_Copyright [get]
 
int MPTK_DeltaTicksPerQuarterNote [get]
 
TimeSpan MPTK_Duration [get]
 
float MPTK_DurationMS [get]
 
bool MPTK_IsPaused [get]
 
bool MPTK_IsPlaying [get]
 
bool MPTK_KeepEndTrack [get, set]
 
bool MPTK_KeepNoteOff [get, set]
 
MPTKEvent MPTK_LastEventPlayed [get]
 
bool MPTK_Loop [get, set]
 
bool MPTK_MidiAutoRestart [get, set]
 
List< MPTKEventMPTK_MidiEvents [get]
 
int MPTK_MidiIndex [get, set]
 
MidiLoad MPTK_MidiLoaded [get]
 
virtual string MPTK_MidiName [get, set]
 
bool MPTK_PlayOnStart [get, set]
 
TimeSpan MPTK_PlayTime [get]
 
double MPTK_Position [get, set]
 
double MPTK_PositionFirstNote [get]
 
double MPTK_PositionLastNote [get]
 
string MPTK_ProgramName [get]
 
double MPTK_PulseLenght [get]
 
int MPTK_Quantization [get, set]
 
double MPTK_RealTime [get]
 
string MPTK_SequenceTrackName [get]
 
float MPTK_Speed [get, set]
 
double MPTK_Tempo [get, set]
 
string MPTK_TextEvent [get]
 
long MPTK_TickCurrent [get, set]
 
long MPTK_TickFirstNote [get]
 
long MPTK_TickLast [get]
 
long MPTK_TickLastNote [get]
 
int MPTK_TrackCount [get]
 
string MPTK_TrackInstrumentName [get]
 
- Properties inherited from MidiPlayerTK.MidiSynth
bool MPTK_ApplySFChorus [get, set]
 Apply chorus effect as defined in the SoundFont.
This effect is processed with the fluidsynth algo independently on each voices but with a small decrease of performace(10%). More...
 
bool MPTK_ApplySFFilter [get, set]
 
bool MPTK_ApplySFReverb [get, set]
 Apply reverberation effect as defined in the SoundFont.
This effect is processed with the fluidsynth algo independently on each voices but with a small decrease of performace(40%). More...
 
bool MPTK_ApplyUnityChorus [get, set]
 
bool MPTK_ApplyUnityReverb [get, set]
 
float MPTK_ChorusDelay [get, set]
 
float MPTK_ChorusDepth [get, set]
 
float MPTK_ChorusDryMix [get, set]
 
float MPTK_ChorusRate [get, set]
 
float MPTK_ChorusWetMix1 [get, set]
 
float MPTK_ChorusWetMix2 [get, set]
 
float MPTK_ChorusWetMix3 [get, set]
 
int MPTK_IndexSynthBuffSize [get, set]
 
int MPTK_IndexSynthRate [get, set]
 
string MPTK_InstrumentPlayed [get]
 
bool MPTK_IsSpatialSynthMaster [get]
 
bool MPTK_KeepPlayingNonLooped [get, set]
 
float MPTK_MaxDistance [get, set]
 
bool MPTK_PauseOnDistance [get, set]
 
float MPTK_ReverbDecayHFRatio [get, set]
 
float MPTK_ReverbDecayTime [get, set]
 
float MPTK_ReverbDelay [get, set]
 
float MPTK_ReverbDensity [get, set]
 
float MPTK_ReverbDiffusion [get, set]
 
float MPTK_ReverbDryLevel [get, set]
 
float MPTK_ReverbHFReference [get, set]
 
float MPTK_ReverbLevel [get, set]
 
float MPTK_ReverbLFReference [get, set]
 
float MPTK_ReverbReflectionDelay [get, set]
 
float MPTK_ReverbReflectionLevel [get, set]
 
float MPTK_ReverbRoom [get, set]
 
float MPTK_ReverbRoomHF [get, set]
 
float MPTK_ReverbRoomLF [get, set]
 
float MPTK_SFChorusDepth [get, set]
 
float MPTK_SFChorusLevel [get, set]
 
float MPTK_SFChorusSpeed [get, set]
 
float MPTK_SFChorusWidth [get, set]
 
float MPTK_SFFilterQModOffset [get, set]
 
float MPTK_SFReverbDamp [get, set]
 
float MPTK_SFReverbLevel [get, set]
 
float MPTK_SFReverbRoomSize [get, set]
 
float MPTK_SFReverbWidth [get, set]
 
bool MPTK_Spatialize [get, set]
 
int MPTK_SpatialSynthIndex [get]
 
int MPTK_SynthRate [get, set]
 
string MPTK_TrackName [get]
 
int MPTK_TransExcludedChannel [get, set]
 
int MPTK_Transpose [get, set]
 
float MPTK_Volume [get, set]
 

Additional Inherited Members

- Public Types inherited from MidiPlayerTK.MidiFilePlayer
enum  ModeStopPlay { StopNoWaiting , StopWhenAllVoicesReleased , StopWhenAllVoicesEnded }
 Defined when the MIDI player is stopped. More...
 
- Public Types inherited from MidiPlayerTK.MidiSynth
enum  ModeSpatializer { Channel , Track }
 
- Public Attributes inherited from MidiPlayerTK.MidiFilePlayer
MPTKInnerLoop MPTK_InnerLoop
 
bool MPTK_LogLoadEvents
 
ModeStopPlay MPTK_ModeStopVoice
 
bool MPTK_PauseOnFocusLoss
 
bool MPTK_StartPlayAtFirstNote
 
LoadingStatusMidiEnum MPTK_StatusLastMidiLoaded
 
EventEndMidiClass OnEventEndPlayMidi
 
EventNotesMidiClass OnEventNotesMidi
 
EventStartMidiClass OnEventStartPlayMidi
 
- Public Attributes inherited from MidiPlayerTK.MidiSynth
bool MPTK_ApplyModLfo
 
bool MPTK_ApplyRealTimeModulator
 
bool MPTK_ApplyVibLfo
 
bool MPTK_AudioSettingFromUnity
 
bool MPTK_AutoBuffer = true
 
int MPTK_AutoCleanVoiceLimit
 
bool MPTK_CorePlayer
 
float MPTK_CutOffVolume = 0.0001f
 
bool MPTK_DirectSendToPlayer
 
bool MPTK_EnableChangeTempo
 
bool MPTK_EnableFreeSynthRate = false
 
bool MPTK_EnablePanChange
 
bool MPTK_EnablePresetDrum
 
bool MPTK_KillByExclusiveClass = true
 
float MPTK_LeanSynthStarting = 0.05f
 
bool MPTK_LogEvents
 
bool MPTK_LogWave
 
bool MPTK_ReleaseSameNote = true
 
uint MPTK_ReleaseTimeMin = 500000
 
float MPTK_ReleaseTimeMod = 1f
 
bool MPTK_ResetChannel = true
 
float MPTK_SFChorusAmplify
 
float MPTK_SFFilterFreqOffset = 0f
 
float MPTK_SFReverbAmplify
 
bool MPTK_SpatialSynthEnabled
 
int MPTK_StatVoiceCountActive
 
int MPTK_StatVoiceCountFree
 
int MPTK_StatVoiceCountPlaying
 
int MPTK_StatVoicePlayed
 
float MPTK_StatVoiceRatioReused
 
bool MPTK_WeakDevice
 
Action< int, long, int, int > OnBeatEvent
 Action executed at each quarter with: More...
 
EventSynthClass OnEventSynthAwake
 
EventSynthClass OnEventSynthStarted
 
Func< MPTKEvent, bool > OnMidiEvent
 
bool playOnlyFirstWave
 
- Static Public Attributes inherited from MidiPlayerTK.MidiSynth
static List< MidiFilePlayerSpatialSynths
 
- Events inherited from MidiPlayerTK.MidiSynth
OnAudioFrameStartHandler OnAudioFrameStart
 

Detailed Description

Play a Local MIDI file or from a Web site. This class must be used with the prefab MidiExternalPlayer

There is no need to writing a script. For a simple usage, all the job can be done in the prefab inspector.

But a set of methods are available in this class to drive the music from your script.
This class inherits from MidiFilePlayer and MidiSynth, so all properties, event, methods from MidiFilePlayer and MidiSynth are available in this class.

More information here: https://paxstellar.fr/midi-external-player-v2/

Attention
MidiExternalPlayer inherits of classes MidiFilePlayer and MidiSynth. For clarity, only MidiExternalPlayer attibutes are provided here. Look at the classes MidiFilePlayer and MidiSynth to discover all attributes available.
Version
Maestro Pro

Exemple for loading and playing a MIDI file from a web site.

// Example of script. See TestMidiExternalPlayer.cs for a more detailed usage.
// Need for a reference to the Prefab (to be set in the hierarchy or can be done by script)
MidiExternalPlayer midiExternalPlayer;
if (midiExternalPlayer==null)
Debug.LogError("TestMidiExternalPlayer: there is no MidiExternalPlayer Prefab set in Inspector.");
// Load a MIDI from a web site
midiExternalPlayer.MPTK_MidiName = "http://www.midiworld.com/midis/other/c2/bolero.mid";
midiExternalPlayer.MPTK_Play();
// more later ... load from a local folder (MacOS here)
midiExternalPlayer.MPTK_MidiName = "file:///Users/thierry/Desktop/Nirvana.mid"
midiExternalPlayer.MPTK_Play();
Play a Local MIDI file or from a Web site. This class must be used with the prefab MidiExternalPlayer
Definition: MidiExternalPlayer.cs:42
override void MPTK_Play(bool alreadyLoaded=false)
Play the midi file defined with MPTK_MidiName or MPTK_MidiIndex.
Definition: MidiExternalPlayer.cs:94

Member Function Documentation

◆ MPTK_Play()

override void MidiPlayerTK.MidiExternalPlayer.MPTK_Play ( bool  alreadyLoaded = false)
virtual

Play the midi file defined with MPTK_MidiName or MPTK_MidiIndex.

Parameters
alreadyLoadedtrue: the MIDI has already been loaded (see MPTK_Load() v2.9.0

Reimplemented from MidiPlayerTK.MidiFilePlayer.

Property Documentation

◆ MPTK_MidiName

new string MidiPlayerTK.MidiExternalPlayer.MPTK_MidiName
getset

Full path to Midi file or URL to play. Must start with file:// or http:// or https://.
Example: MPTK_MidiName="http://www.midiworld.com/midis/other/c2/bolero.mid";
See https://en.wikipedia.org/wiki/File_URI_scheme for example of URI file