MidiPlayerTK Namespace Reference

Classes

class  MidiExternalPlayer
 Play a Local MIDI file or from a Web site. This class must be used with the prefab MidiExternalPlayer
More...
 
class  MidiFileLoader
 @Warning - will be soon deprecated, please rather use MidiFilePlayer prefab which have the same features + eventually MIDI sequencer and MIDI synth! Exemple for just loading a MIDI with MidiFilePlayer:
More...
 
class  MidiFilePlayer
 Play a MIDI file from the MidiDB. This class must be used with the prefab MidiFilePlayer.
See "Midi File Setup" in the Unity menu MPTK for adding MIDI in MidiDB.
More...
 
class  MidiInReader
 Read MIDI events from a MIDI keyboard connected to your Windows or Mac desktop. This class must be used with the prefab MidiInReader.
There is no need to writing a script. For a simple usage, all the job can be done in the prefab inspector. More information here https://paxstellar.fr/prefab-midiinreader/
More...
 
class  MidiKeyboard
 Base class to send and receive Midi Message from a Midi keyboard connected to the desktop
More...
 
class  MidiListPlayer
 Play a list of pre-selected MIDI files from the MidiDB. This class must be used with the prefab MidiListPlayer.
More...
 
class  MidiLoad
 Base class for loading a MIDI file and reading MIDI event in a MIDI sequencer. It's not possible to instanciate directly this class.
Rather, use MidiFilePlayer to load a MIDI This class is used by MidiFilePlayer, MidiListPlayer, MidiFileWrite2, MidiFileLoader (see members MPTK_MidiLoaded of these classes).
More...
 
class  MidiPlayerGlobal
 Singleton class to manage all globales MPTK features. More information here: https://paxstellar.fr/midiplayerglobal/ More...
 
class  MidiSpatializer
 For playing Spatialized MIDI by channels or by tracks from the MidiDB. This class must be used with the prefab MidiSpatializer. More...
 
class  MidiStreamPlayer
 Build and Play Real Time Music in relation with user actions or algorithms. This class must be used with the prefab MidiStreamPlayer.
More...
 
class  MidiSynth
 Base class wich contains all the stuff to build a Wave Table Synth. More...
 
class  MPTKChannel
 Description of a MIDI Channel associated to the MIDI synth.
Each MIDI Synth is equipped with 16 channels which carry all the MIDI information pertinent. They serve to distinguish between instruments and provide independent control over each one.
By transmitting MIDI messages on their respective channels, you can alter the instrument, volume, pitch, and other parameters.
Within the Maestro Midi Player Toolkit, MIDI channels are designated numerically from 0 to 15. Notably, channel 9 is set aside specifically for drum sounds. More...
 
class  MPTKChannels
 Description and list of MIDI Channels associated to the MIDI synth.
Each MIDI Synth is equipped with 16 channels which carry all the MIDI information pertinent. They serve to distinguish between instruments and provide independent control over each one.
By transmitting MIDI messages on their respective channels, you can alter the instrument, volume, pitch, and other parameters.
Within the Maestro Midi Player Toolkit, MIDI channels are designated numerically from 0 to 15. Notably, channel 9 is set aside specifically for drum sounds. More...
 
class  MPTKChordBuilder
 Build Chord and Play with MidiStreamPlayer.
More...
 
class  MPTKChordLib
 Build Chord from a library and Play with MidiStreamPlayer.
More...
 
class  MPTKEffectSoundFont
 A SoundFont contains parameters to apply three kinds of effects: low-pass filter, reverb, chorus.
These parameters can be specifics for each instruments and even each voices.
Maestro MPTK effects are based on FluidSynth algo effects modules. Furthermore, to get more liberty from SoundFont, Maestro can increase or decrease the impact of effects (from the inspector or by script). To summarize: More...
 
class  MPTKEffectUnity
 Unlike SoundFont effects, they applied to the whole player. On the other hand, the Unity effects parameters are rich and, obviously based on Uniy algo!
https://docs.unity3d.com/Manual/class-AudioEffectMixer.html
Only most important effect are integrated in Maestro: Reverb and Chorus. On need, others effects could be added. More...
 
class  MPTKEvent
 Description of a MIDI Event. It's the heart of MPTK! Essential to handling MIDI by script from all others classes as MidiStreamPlayer, MidiFilePlayer, MidiFileLoader, MidiFileWriter2 ...
More...
 
class  MPTKFootPrint
 Experimental - Search a MIDI from a sequence of notes and calculate a score tempo.
More...
 
class  MPTKInnerLoop
 Setting for MIDI inner loop [Pro]. Look at MidiFilePlayer.MPTK_InnerLoop
Example: More...
 
class  MPTKListItem
 This class is useful when a list of paired value string+id is needed.
More...
 
class  MPTKScaleLib
 Build Scale and Play with MidiStreamPlayer.
More...
 
class  MPTKSignature
 Contains information about signature change.
More...
 
class  MPTKTempo
 Contains information about the tempo change.
More...
 
class  MPTKWriter
 Create, build, write, import, play MIDI by script. See full example with these scripts: More...
 

Enumerations

enum  LoadingStatusMidiEnum {
  NotYetDefined = -1 , Success = 0 , NotFound = 1 , TooShortSize = 2 ,
  NoMThdSignature = 3 , NetworkError = 4 , MidiFileInvalid = 5 , SoundFontNotLoaded = 6 ,
  AlreadyPlaying = 7 , MidiNameInvalid = 8 , MidiNameNotDefined = 9 , MidiFileEmpty = 10
}
 
enum  LoadingStatusSoundFontEnum {
  InProgress = -1 , Success = 0 , NoRIFFSignature = 3 , NetworkError = 4 ,
  SoundFontNotLoaded = 6 , InvalidURL = 8 , SoundFontEmpty = 10
}
 
enum  midi_rpn_event { RPN_PITCH_BEND_RANGE = 0x00 , RPN_CHANNEL_FINE_TUNE = 0x01 , RPN_CHANNEL_COARSE_TUNE = 0x02 , RPN_TUNING_PROGRAM_CHANGE = 0x03 , RPN_TUNING_BANK_SELECT = 0x04 , RPN_MODULATION_DEPTH_RANGE = 0x05 }
 
enum  MPTKChordName
 List of chords available More...
 
enum  MPTKCommand : byte {
  NoteOff = 0x80 , NoteOn = 0x90 , KeyAfterTouch = 0xA0 , ControlChange = 0xB0 ,
  PatchChange = 0xC0 , ChannelAfterTouch = 0xD0 , PitchWheelChange = 0xE0 , Sysex = 0xF0 ,
  Eox = 0xF7 , TimingClock = 0xF8 , StartSequence = 0xFA , ContinueSequence = 0xFB ,
  StopSequence = 0xFC , AutoSensing = 0xFE , MetaEvent = 0xFF
}
 
enum  MPTKController : byte {
  BankSelectMsb = 0 , Modulation = 1 , BreathController = 2 , FootController = 4 ,
  PORTAMENTO_TIME_MSB = 0x05 , DATA_ENTRY_MSB = 6 , VOLUME_MSB = 7 , BALANCE_MSB = 8 ,
  Pan = 10 , Expression = 11 , EFFECTS1_MSB = 12 , EFFECTS2_MSB = 13 ,
  GPC1_MSB = 16 , GPC2_MSB = 17 , GPC3_MSB = 18 , GPC4_MSB = 19 ,
  BankSelectLsb = 32 , MODULATION_WHEEL_LSB = 33 , BREATH_LSB = 34 , FOOT_LSB = 36 ,
  PORTAMENTO_TIME_LSB = 37 , DATA_ENTRY_LSB = 38 , VOLUME_LSB = 39 , BALANCE_LSB = 40 ,
  PAN_LSB = 42 , EXPRESSION_LSB = 43 , EFFECTS1_LSB = 44 , EFFECTS2_LSB = 45 ,
  GPC1_LSB = 48 , GPC2_LSB = 49 , GPC3_LSB = 50 , GPC4_LSB = 51 ,
  Sustain = 64 , Portamento = 65 , Sostenuto = 66 , SoftPedal = 67 ,
  LegatoFootswitch = 68 , HOLD2_SWITCH = 69 , SOUND_CTRL1 = 70 , SOUND_CTRL2 = 71 ,
  SOUND_CTRL3 = 72 , SOUND_CTRL4 = 73 , SOUND_CTRL5 = 74 , SOUND_CTRL6 = 75 ,
  SOUND_CTRL7 = 76 , SOUND_CTRL8 = 77 , SOUND_CTRL9 = 78 , SOUND_CTRL10 = 79 ,
  GPC5 = 80 , GPC6 = 81 , GPC7 = 82 , GPC8 = 83 ,
  PORTAMENTO_CTRL = 84 , EFFECTS_DEPTH1 = 91 , EFFECTS_DEPTH2 = 92 , EFFECTS_DEPTH3 = 93 ,
  EFFECTS_DEPTH4 = 94 , EFFECTS_DEPTH5 = 95 , DATA_ENTRY_INCR = 96 , DATA_ENTRY_DECR = 97 ,
  NRPN_LSB = 98 , NRPN_MSB = 99 , RPN_LSB = 100 , RPN_MSB = 101 ,
  AllSoundOff = 120 , ResetAllControllers = 121 , LOCAL_CONTROL = 122 , AllNotesOff = 123 ,
  OMNI_OFF = 124 , OMNI_ON = 125 , POLY_OFF = 126 , POLY_ON = 127
}
 
enum  MPTKMeta : byte {
  TrackSequenceNumber = 0x00 , TextEvent = 0x01 , Copyright = 0x02 , SequenceTrackName = 0x03 ,
  TrackInstrumentName = 0x04 , Lyric = 0x05 , Marker = 0x06 , CuePoint = 0x07 ,
  ProgramName = 0x08 , DeviceName = 0x09 , MidiChannel = 0x20 , MidiPort = 0x21 ,
  EndTrack = 0x2F , SetTempo = 0x51 , SmpteOffset = 0x54 , TimeSignature = 0x58 ,
  KeySignature = 0x59 , SequencerSpecific = 0x7F
}
 
enum  MPTKScaleName
 List of ranges available More...
 

Enumeration Type Documentation

◆ LoadingStatusMidiEnum

Status of the last midi file loaded

  • -1: midi file is loading
  • 0: succes, midi file loaded
  • 1: error, no Midi found
  • 2: error, not a midi file, too short size
  • 3: error, not a midi file, signature MThd not found.
  • 4: error, network error or site not found.
Enumerator
NotYetDefined 

-1: midi file is loading.

Success 

0: succes, midi file loaded.

NotFound 

1: error, no Midi file found.

TooShortSize 

2: error, not a midi file, too short size.

NoMThdSignature 

3: error, not a midi file, signature MThd not found.

NetworkError 

4: error, network error or site not found.

MidiFileInvalid 

5: error, midi file corrupted, error detected when loading the midi events.

SoundFontNotLoaded 

6: SoundFont not loaded.

AlreadyPlaying 

7: error, Already playing.

MidiNameInvalid 

8: error, MPTK_MidiName must start with file:// or http:// or https:// (only for MidiExternalPlayer).

MidiNameNotDefined 

9: error, Set MPTK_MidiName by script or in the inspector with Midi Url/path before playing.

MidiFileEmpty 

10: error, Read 0 byte from the MIDI file.

◆ LoadingStatusSoundFontEnum

Status of the last SoundFont loaded

Enumerator
InProgress 

-1: SoundFont is loading.

Success 

0: succes, SoundFont loaded.

NoRIFFSignature 

1: error, no SoundFont found.

2: error, not a SoundFont, too short size.

3: error, not a SoundFont, signature RIFF not found.

NetworkError 

4: error, network error or site not found.

SoundFontNotLoaded 

5: error, SoundFont corrupted, error detected when loading the SoundFont.

6: SoundFont not loaded.

InvalidURL 

7: error, Already playing.

AlreadyPlaying = 7,

8: error, URL must start with file:// or http:// or https://

◆ midi_rpn_event

General MIDI RPN event numbers (LSB, MSB = 0) The only confusing part of using parameter numbers, initially, is that there are two parts to using them.
First you need to tell the synthesizer what parameter you want to change, then you need to tell it how to change the parameter.
For example, if you want to change the "pitch bend sensitivity" to 12 semitones, you would send the following controler midi message:

Enumerator
RPN_PITCH_BEND_RANGE 

Change pitch bend sensitivity

◆ MPTKChordName

List of chords available

Version
Maestro Pro

◆ MPTKCommand

MIDI command codes. Defined the action to be done with the message: note on/off, change instrument, ...
Depending of the command selected, others properties must be set; Value, Channel, ...

Enumerator
NoteOff 

Note Off
Stop the note defined with the Value and the Channel

NoteOn 

Note On.

KeyAfterTouch 

Key After-touch.
Not processed by Maestro Synth.

ControlChange 

Control change.

PatchChange 

Patch change.

  • MPTKEvent.Value contains patch/preset/instrument to select between 0 and 127.
ChannelAfterTouch 

Channel after-touch.
Not processed by Maestro Synth.

PitchWheelChange 

Pitch wheel change
MPTKEvent.Value contains the Pitch Wheel Value between 0 and 16383.
Higher values transpose pitch up, and lower values transpose pitch down.
The default sensitivity value is 2. That means that the maximum pitch bend will result in a pitch change of two semitones
above and below the sounding note, meaning a total of four semitones from lowest to highest pitch bend positions.

  • 0 is the lowest bend positions (default is 2 semitones),
  • 8192 (0x2000) centered value, the sounding notes aren't being transposed up or down,
  • 16383 (0x3FFF) is the highest pitch bend position (default is 2 semitones)
Sysex 

Sysex message - not processed by Maestro

Eox 

Eox (comes at end of a sysex message) - not processed by Maestro

TimingClock 

Timing clock
(used when synchronization is required)

StartSequence 

Start sequence

ContinueSequence 

Continue sequence

StopSequence 

Stop sequence

AutoSensing 

Auto-Sensing

MetaEvent 

Meta events are optionnals information that could be defined in a MIDI. None are mandatory
In MPTKEvent the attibute MPTKEvent::Meta defined the type of meta event. See MPTKMeta (TextEvent, Lyric, TimeSignature, ...).

◆ MPTKController

Midi Controller list.
Each MIDI CC operates at 7-bit resolution, meaning it has 128 possible values. The values start at 0 and go to 127.
Some instruments can receive higher resolution data for their MIDI control assignments. These high res assignments are defined by combining two separate CCs,
one being the Most Significant Byte (MSB), and one being the Least Significant Byte (LSB).
Most instruments just receive the MSB with default 7-bit resolution. See more information here https://www.presetpatch.com/midi-cc-list.aspx

Enumerator
BankSelectMsb 

Bank Select (MSB)

Modulation 

Modulation (MSB)

BreathController 

Breath Controller

FootController 

Foot controller (MSB)

VOLUME_MSB 

Channel volume (was MainVolume before v2.88.2

Pan 

Pan MSB

Expression 

Expression (EXPRESSION_MSB)

BankSelectLsb 

Bank Select LSB.
MPTK bank style is FLUID_BANK_STYLE_GS (see fluidsynth), bank = CC0/MSB (CC32/LSB ignored)

Sustain 

Sustain

Portamento 

Portamento On/Off - not yet imlemented

Sostenuto 

Sostenuto On/Off - not yet imlemented

SoftPedal 

Soft Pedal On/Off - not yet imlemented

LegatoFootswitch 

Legato Footswitch - not yet imlemented

NRPN_LSB 

Non Registered Parameter Number LSB
http://www.philrees.co.uk/nrpnq.htm

NRPN_MSB 

Non Registered Parameter Number MSB
http://www.philrees.co.uk/nrpnq.htm

RPN_LSB 

Registered Parameter Number LSB
http://www.philrees.co.uk/nrpnq.htm

RPN_MSB 

Registered Parameter Number MSB
http://www.philrees.co.uk/nrpnq.htm

AllSoundOff 

<summary

>All sound off (ALL_SOUND_OFF)

ResetAllControllers 

Reset all controllers (ALL_CTRL_OFF)

AllNotesOff 

All notes off (ALL_NOTES_OFF)

◆ MPTKMeta

enum MidiPlayerTK.MPTKMeta : byte

MIDI MetaEvent Type. Meta events are optionnals information that could be defined in a MIDI. None are mandatory
In MPTKEvent the attibute MPTKEvent.Meta defined the type of meta event.

Enumerator
TrackSequenceNumber 

Track sequence number

TextEvent 

Text event

Copyright 

Copyright

SequenceTrackName 

Sequence track name

TrackInstrumentName 

Track instrument name

Lyric 

Lyric

Marker 

Marker

CuePoint 

Cue point

ProgramName 

Program (patch) name

DeviceName 

Device (port) name

MidiChannel 

MIDI Channel (not official?)

MidiPort 

MIDI Port (not official?)

EndTrack 

End track

SetTempo 

Set tempo MPTKEvent.Value contains new Microseconds Per Beat Note.

Deprecated:
MPTKEvent.Value content with version 2.10.0 - Now MPTKEvent.Duration no longer contains tempo in quarter per minute. Please investigate MPTKEvent.QuarterPerMicroSecond2BeatPerMinute()
SmpteOffset 

MPTE offset

TimeSignature 

Time signature MPTKEvent.Value contains four bytes. From less significant to most significant. Please investigate MPTKEvent.ExtractFromInt():

  1. Numerator (number of beats in a bar),
  2. Denominator (Beat unit: 1 means 2, 2 means 4 (crochet), 3 means 8 (quaver), 4 means 16, ...)
  3. TicksInMetronomeClick, generally 24 (number of 1/32nds of a note happen by MIDI quarter note)
  4. No32ndNotesInQuarterNote, generally 8 (standard MIDI clock ticks every 24 times every quarter note)
    Deprecated:
    MPTKEvent.Value content with version 2.10.0 - Now MPTKEvent.Value no longer contains the numerator and MPTKEvent.Duration the Denominator (all values are merged in MPTKEvent::Value
KeySignature 

Key signature MPTKEvent.Value contains two bytes. From less significant to most significant. Please investigate MPTKEvent.ExtractFromInt().

  1. SharpsFlats (number of sharp)
  2. MajorMinor flag (0 the scale is major, 1 the scale is minor).
    Deprecated:
    MPTKEvent.Value content with version 2.10.0 - MPTKEvent.Duration no longer contains the MajorMinor.
SequencerSpecific 

Sequencer specific

◆ MPTKScaleName

List of ranges available

Version
Maestro Pro