[MPTK PRO] Play a Local MIDI file or from a Web site. This class must be used with the prefab MidiExternalPlayer
More...
Public Types | |
enum | ModeSpatializer { Channel , Track } |
Public Member Functions | |
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) |
new MidiLoad | MPTK_Load () |
new void | MPTK_Next () |
MPTKEvent.EnumLength | MPTK_NoteLength (MPTKEvent note) |
void | MPTK_Pause (float timeToPauseMS=-1f) |
override void | MPTK_Play () |
void | MPTK_Play (byte[] data) |
virtual void | MPTK_Play (float delayRampUp, float startDelay=0) |
void | MPTK_Play (MidiFileWriter2 mfw2, float delayRampUp=0f) |
void | MPTK_PlayNextOrPrevious (int offset) |
new void | MPTK_Previous () |
List< MPTKEvent > | MPTK_ReadMidiEvents (long fromTicks=0, long toTicks=long.MaxValue) |
void | MPTK_RePlay () |
void | MPTK_ResetStat () |
void | MPTK_ReverbSetDefault () |
bool | MPTK_SearchMidiToPlay (string name) |
void | MPTK_SFChorusSetDefault () |
void | MPTK_SFFilterSetDefault () |
void | MPTK_SFReverbSetDefault () |
void | MPTK_StartSequencerMidi () |
void | MPTK_Stop () |
virtual void | MPTK_Stop (float delayRampDown, float stopDelay=0) |
void | MPTK_StopSynth () |
void | MPTK_SwitchMidiWithDelay (int index, string name, float volume, float delayToStopMillisecond, float delayToStartMillisecond) |
void | MPTK_UnPause () |
IEnumerator | MPTK_WaitAllNotesOff (int _idSession=-1) |
delegate void | OnAudioFrameStartHandler (double synthTime) |
Static Public Attributes | |
static List< MidiFilePlayer > | SpatialSynths |
Events | |
OnAudioFrameStartHandler | OnAudioFrameStart |
[MPTK PRO] 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/
|
inherited |
[MPTK PRO] Spatializer Mode for the prefab MidiSpatializer
Enumerator | |
---|---|
Channel | Spatial Synth are enabled to dispatch note-on by channels. |
Track | Spatial Synth are enabled to dispatch note-on by tracks defined in the MIDI. |
|
inherited |
Get the current bank associated to the channel.
Each MIDI channel can play a different preset and bank.
channel | MIDI channel must be between 0 and 15 |
|
inherited |
Get the current preset name for the channel.
Each MIDI channel can play a different preset.
channel | MIDI channel must be between 0 and 15 |
controller | MIDI Controller must be between 0 and 127. See MPTKEvent::Controller |
|
inherited |
Get channel length. The midi norm is 16, but MPTK can manage up to 32 channels (experimental).
channel | must be between 0 and 15 |
|
inherited |
Is channel is enabled or disabled.
channel | channel, must be between 0 and 15 |
|
inherited |
Disable (mute) or enable (unmute) a MIDI channel.
channel | must be between 0 and 15 |
enable | true to unmute (default), false to mute channel |
|
inherited |
Set forced preset on the channel. MIDI will allways playing with this preset even if a MIDI Preset Change message is received.
Set to -1 to disable this behavior.
channel |
|
inherited |
Set a Preset on a channel to force the MIDI Synth to always playing with this instrument even if MIDI 'Preset Change' or 'Bank change' messages are received.
Set Preset to -1 to restore the Preset and Bank defined in the MIDI file.
channel | 0 to 15 channel |
preset | Preset to force in the range 0 to 127 preset. Set to -1 to restore the Preset and Bank known from the MIDI file. |
bank | Optionnal. Bank to force in the range 0 to 128. Set to -1 to restore to the last bank known from the MIDI file. |
Another example with MidiExternalPlayer.
|
inherited |
Build an information string about the channel. It's also a good pretext to display an example of Channel API.
Exemple of return
channel | index channel |
|
inherited |
Get count of notes played since the start of the MIDI.
channel | must be between 0 and 15 |
|
inherited |
Change the Preset and/or Bank associated to a Channel.
The new value of the bank or preset are registered in the channel even if the preset or bannk is not found.
Each channel can have a different bank/preset set.
Note 1: When bank is changed, the preset list is not updated (MidiPlayerGlobal.MPTK_ListPreset). Call MidiPlayerGlobal.MPTK_SelectBankInstrument to refresh this list.
Note 2: When playing a MIDI file, MIDI messages like "Patch Change" and "ControlChange BankSelectMsb" will override value registered with this method.
Note 3: To change globally the bank, use instead the global methods: MidiPlayerGlobal.MPTK_SelectBankInstrument or MidiPlayerGlobal.MPTK_SelectBankDrum.
Note 4: The method MPTK_ChannelForcedPresetSet can be used to force the preset whatever the MIDI messages.
channel | 0 to 15. There is 16 channels available in the MIDI norm. |
preset | The total number of presets available depend on the soundfont selected |
bank | Optionnal, if not set or -1 the current bank will be applied (or default bank if never set). Default bank is defined globally: menu MPTK / SoundFont Setup. |
|
inherited |
Get channel preset index.
channel | must be between 0 and 15 |
|
inherited |
Get the current preset name for the channel.
Each MIDI channel can play a different preset.
channel | MIDI channel must be between 0 and 15 |
|
inherited |
Get the volume of the channel
channel | must be between 0 and 15 |
|
inherited |
Set the volume for a channel as a percentage.
channel | must be between 0 and 15 or -1 to apply to all channels |
volume | percentage of volume from the global volume for the channel, must be between 0 and 1 |
|
inherited |
[MPTK PRO] Set Chorus Unity default value as defined with Unity.
|
inherited |
Clear all sound by sending note off.
That could take some seconds because release time for sample need to be played.
destroyAudioSource | usefull only in non core mode |
_idSession | clear only for sample playing with this session, -1 for all (default) |
|
inherited |
Initialize the synthetizer: channel, voices, modulator.
It's not usefull to call this method if you are using prefabs (MidiFilePlayer, MidiStreamPlayer, ...).
Each gameObjects created from these prefabs have their own, autonomous and isolated synth.
channelCount | Number of channel to create, default 16. Any other values are experimental! |
new MidiLoad MidiPlayerTK.MidiExternalPlayer.MPTK_Load | ( | ) |
Not applicable for external
new void MidiPlayerTK.MidiExternalPlayer.MPTK_Next | ( | ) |
Not applicable for external
|
inherited |
Return note length as https://en.wikipedia.org/wiki/Note_value
note |
|
inherited |
Pause the current playing
timeToPauseMS | time to pause in milliseconds. default or < 0 : indefinitely |
|
virtual |
Play the midi file defined in MPTK_MidiName
Reimplemented from MidiPlayerTK.MidiFilePlayer.
|
inherited |
Play the midi file from a byte array.
Look at MPTK_StatusLastMidiLoaded to get status.
|
virtualinherited |
[MPTK PRO] Play the midi file defined with MPTK_MidiName or MPTK_MidiIndex with ramp-up to the volume defined with MPTK_Volume.
The time to get a MIDI playing at full MPTK_Volume is delayRampUp + startDelay.
A delayed start can also be set.
delayRampUp | ramp-up delay in milliseconds to get the default volume |
startDelay | delayed start in milliseconds V2.89.1 |
|
inherited |
[MPTK PRO] Play the midi from a MidiFileWriter2 object
mfw2 | aMidiFileWriter2 object |
delayRampUp |
|
inherited |
[MPTK PRO] Play next or previous Midi from the MidiDB list.
offset | Forward or backward count in the list. 1:the next, -1:the previous |
new void MidiPlayerTK.MidiExternalPlayer.MPTK_Previous | ( | ) |
Not applicable for external
|
inherited |
V2.88.2 - Read the list of midi events available in the MIDI from a ticks position to an end position.
fromTicks | ticks start, default 0 |
toTicks | ticks end, default end of MIDI file |
|
inherited |
Restart playing of the current midi file
|
inherited |
Reset voices statistics
|
inherited |
[MPTK PRO] Set Reverb Unity default value as defined with Unity.
|
inherited |
[MPTK PRO] Find a Midi in the Unity resources folder MidiDB which contains the name (case sensitive)
Tips: Add Midi files to your project with the Unity menu MPTK or add it directly in the ressource folder and open Midi File Setup to automatically integrate Midi in MPTK.
name | case sensitive part of a midi file name |
|
inherited |
[MPTK PRO] Set Chrous SoundFont default value as defined in fluidsynth.
FLUID_CHORUS_DEFAULT_N 3
FLUID_CHORUS_DEFAULT_LEVEL 2.0 but set to 0.9 (thank John)
FLUID_CHORUS_DEFAULT_SPEED 0.3
FLUID_CHORUS_DEFAULT_DEPTH 8.0
FLUID_CHORUS_DEFAULT_TYPE FLUID_CHORUS_MOD_SINE
WIDTH 10
|
inherited |
[MPTK PRO] Set Filter SoundFont default value as defined in fluidsynth.
|
inherited |
[MPTK PRO] Set Reverb SoundFont default value as defined in fluidsynth.
FLUID_REVERB_DEFAULT_ROOMSIZE 0.2f
FLUID_REVERB_DEFAULT_DAMP 0.0f
FLUID_REVERB_DEFAULT_WIDTH 0.5f
FLUID_REVERB_DEFAULT_LEVEL 0.9f
Default chorus voice count
|
inherited |
Start the MIDI sequencer: each midi events are read and play in a dedicated thread.
This thread is automatically started by prefabs MidiFilePlayer, MidiListPlayer, MidiExternalPlayer.
|
inherited |
Stop playing
|
virtualinherited |
[MPTK PRO] Stop playing within a delay. After the stop delay (0 by default), the volume decrease until the playing is stopped.
The time to get a real MIDI stop is delayRampDown + stopDelay.
delayRampDown | decrease time in millisconds |
stopDelay | delayed stop in milliseconds V2.89.1 |
|
inherited |
Stop processing samples by the synth and the MIDI sequencer.
|
inherited |
[MPTK PRO] Switch playing between two MIDIs with ramp-up.
This method is useful for an integration with Bolt: main MIDI parameters are defined in one call.
index | Index of the MIDI to play. Index is used only if name parameter is null or empty. |
name | Name of the MIDI to play. Can be part of the MIDI Name. If set, this parameter has the priority over index parameter. |
volume | Volume of the MIDI. -1 to not change the default volume |
delayToStopMillisecond | Delay to stop the current MIDI playing (with volume decrease) or delay before playing the MIDI if no MIDI is playing |
delayToStartMillisecond | Delay to get the MIDI at full volume (ramp-up volume) |
|
inherited |
UnPause the current playing
|
inherited |
Wait until all notes are off.
That could take some seconds due to the samples release time.
Therefore, the method exit after a timeout of 3 seconds.
*** Use this method only as a coroutine ***
_idSession | clear only for samples playing with this session, -1 for all |
|
inherited |
[MPTK PRO] Delegate for the event OnAudioFrameStartHandler. see OnAudioFrameStart
synthTime |
|
inherited |
Apply LFO effect defined in the SoundFont
|
inherited |
Apply real time modulatoreffect defined in the SoundFont: pitch bend, control change, enveloppe modulation
|
inherited |
[MPTK PRO] 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%).
|
inherited |
[MPTK PRO] Apply frequency low-pass filter 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%).
|
inherited |
[MPTK PRO] 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%).
|
inherited |
Apply vibrato effect defined in the SoundFont
|
inherited |
If true then rate synth and buffer size will be automatically defined by Unity in accordance of the capacity of the hardware. - V2.89.0 -
Look at Unity menu "Edit / Project Settings..." and select between best latency and best performance.
If false, then rate and buffer size can be defined manually ... but with the risk of bad audio quality. It's more an experimental capacities!
|
inherited |
Voice buffering is important to get better performance. But you can disable this fonction with this parameter.
|
inherited |
Free voices older than MPTK_AutoCleanVoiceLimit are removed when count is over than MPTK_AutoCleanVoiceTime
|
inherited |
If true then MIDI events are read and play from a dedicated thread.
If false, MidiSynth will use AudioSource gameobjects to play sound.
This properties must be defined before running the application from the inspector.
The default is true.
Warning: The non core mode player (MPTK_CorePlayer=false) will be removed with the next major version (V3)
|
inherited |
When amplitude is below this value the playing of sample is stopped (voice_off).
Can be increase for better performance but with degraded quality because sample could be stopped earlier. Remember: Amplitude can varying between 0 and 1.
|
inherited |
If true (default) then MIDI events are sent automatically to the midi player.
Set to false if you want to process events without playing sound.
OnEventNotesMidi Unity Event can be used to process each notes.
|
inherited |
Should accept change tempo from MIDI Events ?
|
inherited |
Allow direct setting of the Synth Rate
|
inherited |
Should change pan from MIDI Events or from SoundFont ?
Pan is disabled when Spatialization is activated.
|
inherited |
Should accept change Preset for Drum canal 10 ?
Disabled by default. Could sometimes create bad sound with midi files not really compliant with the MIDI norm.
|
inherited |
V2.83 Find the exclusive class of this voice. If set, kill all voices that match the exclusive class
and are younger than the first voice process created by this noteon event.
|
inherited |
V2.873 - A lean startup of the volume of the synth is useful to avoid weird sound at the beginning of the application (in some cases).
This parameter sets the speed of the increase of the volume of the audio source.
Set to 1 for an immediate full volume at start.
|
inherited |
Log for each wave to be played
|
inherited |
Should the MIDI playing must be paused when the application lost the focus?
|
inherited |
V2.83. If the same note is hit twice on the same channel, then the older voice process is advanced to the release stage.
It's the default Midi processing.
|
inherited |
[Only when CorePlayer=False] Define a minimum release time at noteoff in 100 iem nanoseconds.
Default 50 ms is a good tradeoff. Below some unpleasant sound could be heard. Useless when MPTK_CorePlayer is true.
|
inherited |
When a note is stopped with a noteoff or when the duration is over, note continue to play for a short time depending the instrument.
This parameter is a multiplier to increase or decrease the default release time defined in the SoundFont for each instrument.
Recommended values between 0.1 and 10. Default is 1 (no modification of the release time).
Performance issue: the longer it lasts the more CPU is used after the noteon. With a long release time, a lot of samples will be played simultaneously.
|
inherited |
Reset channel information when MIDI start playing. V2.89.0
|
inherited |
[MPTK PRO] Chorus level is defined in the SoundFont in the range [0, 1].
This parameter is added to the the default SoundFont value.
Range must be [-1, 1]
|
inherited |
[MPTK PRO] Frequency cutoff is defined in the SoundFont for each notes.
This parameter increase or decrease the default SoundFont value. Range: -2000 to 3000
|
inherited |
[MPTK PRO] Reverberation level is defined in the SoundFont in the range [0, 1].
This parameter is added to the the default SoundFont value.
Range must be [-1, 1]
|
inherited |
[MPTK PRO] In spatialization mode not all MidiSynths are enabled.
|
inherited |
When the value is true, the playing begins at the first note found
. Often, the first note is not set at the beginning of the MIDI file (tick=0).
So there is a delay before playing the first note.
This setting is useful to start the playing at the first note found. Apply also when looping.
No impact on MPTK_Duration which stay the same, so there is a shift between the real time of the MIDI and the theoretical duration.
|
inherited |
Status of the last midi loaded. The status is updated in a coroutine, so the status can change at each frame.
|
inherited |
Count of the active voices (playing) - Readonly
|
inherited |
Count of the free voices for reusing on need.
Voice older than AutoCleanVoiceTime are removed but only when count is over than AutoCleanVoiceLimit - Readonly
|
inherited |
Count of voice played since the start of the synth
|
inherited |
Percentage of voice reused during the synth life. 0: any reuse, 100:all voice reused (unattainable, of course!)
|
inherited |
Should play on a weak device (cheaper smartphone) ? Apply only with AudioSource mode (MPTK_CorePlayer=False).
Playing MIDI files with WeakDevice activated could cause some bad interpretation of MIDI Event, consequently bad sound.
|
inherited |
Define the Unity event to be triggered at end of playing the midi.
|
inherited |
Define the Unity event to be triggered when notes are available from the MIDI file.
It's not possible to alter playing music by modifying note properties (pitch, velocity, ....) here.
|
inherited |
Define the Unity event to be triggered at start of playing the Midi.
MIDI File is loaded, Midi Synth is initialized, but so far any MIDI event has been read.
This is the right time to defined some specific behaviors.
|
inherited |
Unity event fired at awake of the synthesizer. Name of the gameobject component is passed as a parameter.
Setting this callback function by script (AddListener) is not recommended. It's better to set callback function from the inspector.
Example of script (but it's recommended to set callback function from the inspector).
|
inherited |
Unity event fired at start of the synthesizer. Name of the gameobject component is passed as a parameter.
Setting this callback function by script (AddListener) is not recommended. It's better to set callback function from the inspector.
Example of script (it's recommended to set callback function from the inspector).
|
inherited |
[MPTK PRO] V2.89.0 - This function is called by the MIDI sequencer before sending the MIDI message to the MIDI synthesizer.
It can be used like a MIDI events preprocessor: it's possible to change the value of the MIDI events and therefore change the playback of the song.
The callback function receives a MPTKEvent object by reference (normal, it's a C# class).
Look at https://mptkapi.paxstellar.com/d9/d50/class_midi_player_t_k_1_1_m_p_t_k_event.html
A lot change is possible on the MIDI event: change note, velocity, channel, ..., even changing the MIDI type of the message!!!
See below some examples of changes.
|
inherited |
Preset are often composed with 2 or more samples, classically for left and right channel. Check this to play only the first sample found
|
staticinherited |
Contains each Midi Synth for each channel or track when the prefab MidiSpatializer is used and IsMidiChannelSpace=true.
Warning: only one MidiSpatializer can be used in a hierarchy.
|
getsetinherited |
[MPTK PRO] Apply Chorus Unity effect to the AudioSource. The effect is applied to all voices.
|
getsetinherited |
[MPTK PRO] Apply Reverb Unity effect to the AudioSource. The effect is applied to all voices.
|
getsetinherited |
[MPTK PRO] Chorus delay in ms.
Range from 0.1 to 100. Default = 40 ms.
|
getsetinherited |
[MPTK PRO] Chorus modulation depth.
Range from 0 to 1. Default = 0.03.
|
getsetinherited |
[MPTK PRO] Volume of original signal to pass to output.
Range from 0 to 1. Default = 0.5.
|
getsetinherited |
[MPTK PRO] Chorus modulation rate in hz.
Range from 0 to 20. Default = 0.8 hz.
|
getsetinherited |
[MPTK PRO] Volume of 1st chorus tap.
Range from 0 to 1. Default = 0.5.
|
getsetinherited |
[MPTK PRO] Volume of 2nd chorus tap. This tap is 90 degrees out of phase of the first tap.
Range from 0 to 1. Default = 0.5.
|
getsetinherited |
[MPTK PRO] Volume of 3rd chorus tap. This tap is 90 degrees out of phase of the second tap.
Range from 0 to 1. Default = 0.5.
|
getinherited |
Get Copyright if defined in the MIDI file with MIDI MetaEventType = Copyright
See detail here https://ccrma.stanford.edu/~craig/14q/midifile/MidiFileFormat.html
Can be used only when the MIDI is playing.
|
getinherited |
Delta Ticks Per Quarter Note. Indicate the duration time in "ticks" which make up a quarter-note.
For instance, if 96, then a duration of an eighth-note in the file would be 48.
More info here https://paxstellar.fr/2020/09/11/midi-timing/
|
getinherited |
Real duration expressed in TimeSpan of the full midi from the first event (tick=0) to the last event.
If MPTK_KeepEndTrack is false, the MIDI events End Track are not considered to calculate this time.
The tempo changes are taken into account if MPTK_EnableChangeTempo is set to true before loading the MIDI.
|
getinherited |
Real duration expressed in milliseconds of the full midi from the first event (tick=0) to the last event.
If MPTK_KeepEndTrack is false, the MIDI events End Track are not considered to calculate this time.
The tempo changes are taken into account if MPTK_EnableChangeTempo is set to true before loading the MIDI.
|
getsetinherited |
Set or Get synth buffer size -1:default, 0:64, 1;128, 2:256, 3:512, 4:1024, 5:2048.
The change is global for all prefab. It's better to stop playing for all prefab before changing on fly to avoid bad noise or crash.
|
getsetinherited |
Set or Get sample rate output of the synth. -1:default, 0:24000, 1:36000, 2:48000, 3:60000, 4:72000, 5:84000, 6:96000.
It's better to stop playing before changing on fly to avoid bad noise.
|
getinherited |
[MPTK PRO] If spatialization is track mode, contains the last instrument played on this track
|
getinherited |
Is MIDI file playing is paused ?
|
getinherited |
Is MIDI file is playing ?
|
getinherited |
[MPTK PRO] True if this MidiSynth is the master synth responsible to read midi events and to dispatch to other MidiSynths
|
getsetinherited |
When set to true, meta MIDI event End Track are keep. Default is false.
If set to true, the End Track Event are taken into account for calculate the full duration of the MIDI.
See MPTK_DurationMS.
|
getsetinherited |
When the value is true, MIDI NoteOff events are keep from the MIDI file.
NoteOff in the stream have any impact on the MIDI synthesizer because
samples are stopped after a duration not from the NoteOff event.
|
getsetinherited |
V2.83 When the value is true, NoteOff and Duration for non-looped samples are ignored and the samples play through to the end.
|
getinherited |
Last MIDI event read or played
|
getsetinherited |
Log midi events
|
getsetinherited |
When the value is true, the current MIDI playing is restarted when it reaches the end.
The MIDI file doesn't need to be reloaded, the looping is almost immediate.
|
getsetinherited |
If MPTK_Spatialize is enabled, the volume of the audio source depends on the distance between the audio source and the listener.
Beyong this distance, the volume is set to 0 and the midi player is paused. No effect if MPTK_Spatialize is disabled.
|
getinherited |
[DEPRECATED] Get all the raw midi events available in the midi file.
Use rather the method MPTK_ReadMidiEvents from the prefab class MidiFileLoader or from MidiFilePrefab (Pro only).
|
getset |
Not applicable for external
|
getinherited |
Get detailed information about the MIDI playing. This readonly properties is available only when a MIDI has been loaded.
|
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
|
getsetinherited |
[obsolete] replaced by MPTK_Spatialize"); V2.83
|
getsetinherited |
Should the MIDI start playing when the application starts ?
|
getinherited |
Time from the start of playing the current midi
|
getsetinherited |
Set or get the current position in the MIDI.
Note 1: works only when the MIDI is playing.
Note 2: you can't set the position before or just after MPTK_Play() because MPTK_Play() reset the position at the start.
Note 3: rather, set the position when the event OnEventStartPlayMidi() is triggered. See example bellow.
Note 4: look also the properties MPTK_TickCurrent to change the position by MIDI ticks.
Note 5: when the MIDI is playing look at the inspector of the MidiFilePlayer prefab to read (or change) the current position in seconds and find the position you want.
Here, there is more info about Midi Timing https://paxstellar.fr/2020/09/11/midi-timing/
See example:
|
getinherited |
Real time position in millisecond for the first note-on found.
Most MIDI don't start playing a note immediately. There is often a delay.
Use this attribute to known the real time wich it will start.
See also MPTK_TickFirstNote
|
getinherited |
Real time position in millisecond for the last note-on found in the MIDI.
There is often other MIDI events after the last note-on: for example event track-end.
Use this attribute to known the real time when all sound will be stop.
See also the MPTK_DurationMS which provides the full time of all MIDI events including track-end, control at the beginning and at the end, ....
See also MPTK_TickLastNote
|
getinherited |
Get Program track name if defined in the MIDI file with MIDI MetaEventType = ProgramName
See detail here https://ccrma.stanford.edu/~craig/14q/midifile/MidiFileFormat.html
Can be used only when the MIDI is playing.
|
getinherited |
Lenght in millisecond of a MIDI tick. The pulse length is the minimum time in millisecond between two MIDI events.
It's like a definition of resolution: the MIDI sequencer will not be able to play
two separate MIDI events in a time below this value.
Obviously depends on the current tempo and the ticks per quarter.
PulseLenght = tempo / DeltaTicksPerQuarterNote / 1000 / Speed
|
getsetinherited |
Level of quantization :
|
getinherited |
V2.89.0 - Real time in milliseconds from the beginning of playing of the MIDI.
MPTK_Tempo or MPTK_Speed change have no impact, it's just a system timer not linked to MIDI information.
|
getsetinherited |
[MPTK PRO] Decay HF Ratio : High-frequency to low-frequency decay time ratio.
Ranges from 0.1 to 2.0.
|
getsetinherited |
[MPTK PRO] Reverberation decay time at low-frequencies in seconds.
Ranges from 0.1 to 20. Default is 1.
|
getsetinherited |
[MPTK PRO] Late reverberation delay time relative to first reflection in seconds.
Ranges from 0 to 0.1. Default is 0.04
|
getsetinherited |
[MPTK PRO] Reverberation density (modal density) in percent.
Ranges from 0 to 1.
|
getsetinherited |
[MPTK PRO] Reverberation diffusion (echo density) in percent.
Ranges from 0 to 1. Default is 1.
|
getsetinherited |
[MPTK PRO] Mix level of dry signal in output.
Ranges from 0 to 1.
|
getsetinherited |
[MPTK PRO] Reference high frequency in Hz.
Ranges from 1000 to 20000. Default is 5000
|
getsetinherited |
[MPTK PRO] Late reverberation level relative to room effect.
Ranges from 0 to 1.
|
getsetinherited |
[MPTK PRO] Reference low-frequency in Hz.
Ranges from 20 to 1000. Default is 250
|
getsetinherited |
[MPTK PRO] Late reverberation level relative to room effect.
Ranges from -10000.0 to 2000.0. Default is 0.0.
|
getsetinherited |
[MPTK PRO] Early reflections level relative to room effect.
Ranges from 0 to 1.
|
getsetinherited |
[MPTK PRO] Room effect level at low frequencies.
Ranges from 0 to 1.
|
getsetinherited |
[MPTK PRO] Room effect high-frequency level.
Ranges from 0 to 1.
|
getsetinherited |
[MPTK PRO] Room effect low-frequency level.
Ranges from 0 to 1.
|
getinherited |
Get sequence track name if defined in the MIDI file with MIDI MetaEventType = SequenceTrackName
See detail here https://ccrma.stanford.edu/~craig/14q/midifile/MidiFileFormat.html
Can be used only when the MIDI is playing.
|
getsetinherited |
[MPTK PRO] Set the SoundFont chorus effect depth
Chorus depth [0, 256]
V2.88.2
|
getsetinherited |
[MPTK PRO] Set the SoundFont chorus effect level [0, 10]
V2.88.2 - becomes a parameter and default value set to 0.9 (was 2f, thank John)
|
getsetinherited |
[MPTK PRO] Set the SoundFont chorus effect speed
Chorus speed in Hz [0.1, 5]
V2.88.2
|
getsetinherited |
[MPTK PRO] Set the SoundFont chorus effect width
The chorus unit process a monophonic input signal and produces stereo output controlled by WIDTH macro.
Width allows to get a gradually stereo effect from minimum (monophonic) to maximum stereo effect. [0, 10]
V2.88.2
|
getsetinherited |
[MPTK PRO] Quality Factor is defined in the SoundFont for each notes.
This parameter increase or decrease the default SoundFont value. Range: -96 to 96.
|
getsetinherited |
[MPTK PRO] Set the SoundFont reverb effect damp [0,1].
Controls the reverb time frequency dependency. This controls the reverb time for the frequency sample rate/2
When 0, the reverb time for high frequencies is the same as for DC frequency.
When > 0, high frequencies have less reverb time than lower frequencies.
V2.88.2
|
getsetinherited |
[MPTK PRO] Set the SoundFont reverb effect level
V2.88.2
|
getsetinherited |
[MPTK PRO] Set the SoundFont reverb effect room size. Controls concave reverb time between 0 (0.7 s) and 1 (12.5 s)
V2.88.2
|
getsetinherited |
[MPTK PRO] Set the SoundFont reverb effect width [0,100].
Controls the left/right output separation.
When 0, there are no separation and the signal on left and right output is the same.This sounds like a monophonic signal.
When 100, the separation between left and right is maximum.
V2.88.2
|
getsetinherited |
Should the Spatialization effect must be enabled?
See here how to setup spatialization with Unity https://paxstellar.fr/midi-file-player-detailed-view-2/#Foldout-Spatialization-Parameters if MPTK_Spatialize is true:
AudioSource.maxDistance = MPTK_MaxDistance
AudioSource.spatialBlend = 1
AudioSource.spatialize = true
AudioSource.spatializePostEffects = true
|
getinherited |
Index of the MidiSynth for the dedicated Channel or Track when the prefab MidiSpatializer is used.
If MPTK_ModeSpatializer = Channel then represent the playing channel.
If MPTK_ModeSpatializer = Track then represent the playing track.
The value is -1 for the Midi reader because no voice is played.
|
getsetinherited |
Percentage value of the playing speed. Range 0.1 (10%) to 10 (1000%). Default is 1 for normal speed.
|
getsetinherited |
Get the the current synth rate or set free value (only if MPTK_EnableFreeSynthRate is true).
|
getsetinherited |
Get or change the current tempo played by the internal MIDI sequencer (independent from MPTK_Speed).
Return QuarterPerMinuteValue similar to BPM (Beat Per Measure).
Notes:
|
getinherited |
Get Text if defined in the MIDI file with MIDI MetaEventType = TextEvent
See detail here https://ccrma.stanford.edu/~craig/14q/midifile/MidiFileFormat.html
Can be used only when the MIDI is playing.
|
getsetinherited |
Set or get the current tick position in the MIDI.
MIDI tick is an easy way to identify a position in a song independently of the time which could vary with tempo change.
The count of ticks for a quarter is constant all along a Midi: see properties MPTK_DeltaTicksPerQuarterNote.
Example: with a time signature of 4/4 the ticks length of a bar is 4 * MPTK_DeltaTicksPerQuarterNote.
Note 1: works only when the MIDI is playing.
Note 2: you can't set the position before or just after MPTK_Play() because MPTK_Play() reset the position at the start.
Note 3: rather, set the position when the event OnEventStartPlayMidi() is triggereed. See example below.
Note 4: look also the properties MPTK_Position to change the position by milliseconds.
Note 5: when the MIDI is playing look at the inspector of the MidiFilePlayer prefab to read (or change) the current tick and find the position you want.
Here, there is more info about Midi Timing https://paxstellar.fr/2020/09/11/midi-timing/
See example:
|
getinherited |
Tick position for the first note-on found.
Most MIDI don't start playing a note immediately. There is often a delay.
Use this attribute to known the tick position where the will start to play a sound.
See also MPTK_PositionFirstNote
|
getinherited |
Last tick position in Midi: it's the value of the tick for the last MIDI event in sequence expressed in number of "ticks".
|
getinherited |
Tick position for the last note-on found.
There is often other MIDI events after the last note-on: for example event track-end.
Use this attribute to known the tick position time when all sound will be stop.
See also the MPTK_PositionLastNote which provides the last time of the MIDI.
|
getinherited |
Count of track read in the MIDI file
|
getinherited |
Get Instrument track name if defined in the MIDI file with MIDI MetaEventType = TrackInstrumentName
See detail here https://ccrma.stanford.edu/~craig/14q/midifile/MidiFileFormat.html
Can be used only when the MIDI is playing.
|
getinherited |
[MPTK PRO] If spatialization is track mode, contains the last name of the track
|
getsetinherited |
Transpose will apply to all channels except this one. Set to -1 to apply to all channel. V2.89.0
Default is 9 because generally we don't want to transpose drum channel.
|
getsetinherited |
Transpose note from -24 to 24
|
getsetinherited |
Global Volume. apply to all channels.
Must be >=0 and <= 1
|
inherited |
[MPTK PRO] this event is triggered at each start of a new audio frame from the audio engine.
The parameter (double) is the current synth time in milliseconds. See example of use.
The callbach function will not run on the Unity thread, so you can't call Unity API except Debug.Log.