Maestro - Midi Player Tool Kit for Unity Version 2.19.0
Loading...
Searching...
No Matches
MidiPlayerTK.MPTKChordBuilder

Builds chord settings and generated note events. More...

Public Types

enum  Modifier3 {
  Maj , Min , Dim , DimHalf ,
  Aug , Sus2 , Sus4
}
 Triad quality used for three-note chord structures. More...
enum  Modifier4 { Maj6 , Min6 , Maj7 , Min7 }
 Four-note chord extensions. More...

Public Member Functions

 MPTKChordBuilder (bool log=false)
 Creates a default chord: tonic = C3, degree = 1, note count = 3.
void MPTK_BuildFromRange (MPTKScaleLib scale=null)
 Builds a chord from the selected scale. Tonic and Degree must be defined in this MPTKChordBuilder instance. If scale is null, a major scale is used. After the call, Events contains all generated notes for the chord.
void MPTK_BuildFromLib (MPTKChordName chordName)
 Builds a chord from ChordLib.csv under Resources/GeneratorTemplate.
void MPTK_BuildFromLib (int pindex)
 Builds a chord from a zero-based index in ChordLib.csv.

Public Attributes

int Tonic
 Root MIDI note for the chord. 48 = C3, 60 = C4, 61 = C#4, 62 = D4, 72 = C5.
int Count
 Number of notes used to build the chord. Valid range is 2 to 50.
int Degree
 Scale degree from 1 to 7.
int FromLib
 Index of the chord in ChordLib.csv under Resources/GeneratorTemplate. Used by chord playback helpers, for example MidiStreamPlayer.MPTK_PlayChordFromLib(MPTKChordBuilder chord).
int Channel
 MIDI channel from 0 to 15 (9 for drums).
int Velocity
 Velocity between 0 and 127.
long Duration
 Duration of the chord in milliseconds. Set -1 to play indefinitely.
long Delay
 Delay in milliseconds before playing the chord.
long Arpeggio
 Delay in milliseconds between each note in the chord (plays an arpeggio).
List< MPTKEventEvents
 List of MIDI events played for this chord. This list is built when MPTK_PlayChord or MPTK_PlayChordFromLib is called; otherwise, null.

Detailed Description

Builds chord settings and generated note events.

Version
Maestro Pro See examples in TestMidiStream.cs and ExtStreamPlayerPro.cs.

Member Enumeration Documentation

◆ Modifier3

Triad quality used for three-note chord structures.

Enumerator
Maj 

Major triad (1, 3, 5).

Min 

Minor triad (1, b3, 5).

Dim 

Diminished triad (1, b3, b5).

DimHalf 

Half-diminished triad variant (1, 3, b5).

Aug 

Augmented triad (1, 3, #5).

Sus2 

Suspended second triad (1, 2, 5).

Sus4 

Suspended fourth triad (1, 4, 5).

◆ Modifier4

Four-note chord extensions.

Enumerator
Maj6 

Triad plus major sixth.

Min6 

Triad plus minor sixth.

Maj7 

Triad plus major seventh.

Min7 

Triad plus minor seventh.

Constructor & Destructor Documentation

◆ MPTKChordBuilder()

MidiPlayerTK.MPTKChordBuilder.MPTKChordBuilder ( bool log = false)

Creates a default chord: tonic = C3, degree = 1, note count = 3.

Parameters
logTrue to enable debug logging.

Member Function Documentation

◆ MPTK_BuildFromRange()

void MidiPlayerTK.MPTKChordBuilder.MPTK_BuildFromRange ( MPTKScaleLib scale = null)

Builds a chord from the selected scale. Tonic and Degree must be defined in this MPTKChordBuilder instance. If scale is null, a major scale is used. After the call, Events contains all generated notes for the chord.

Version
Maestro Pro
Parameters
scaleScale source used to resolve chord notes. If null, a default major scale is created.

◆ MPTK_BuildFromLib() [1/2]

void MidiPlayerTK.MPTKChordBuilder.MPTK_BuildFromLib ( MPTKChordName chordName)

Builds a chord from ChordLib.csv under Resources/GeneratorTemplate.

Version
Maestro Pro
Parameters
chordNameName of the chord.

◆ MPTK_BuildFromLib() [2/2]

void MidiPlayerTK.MPTKChordBuilder.MPTK_BuildFromLib ( int pindex)

Builds a chord from a zero-based index in ChordLib.csv.

Version
Maestro Pro
Parameters
pindexZero-based position in ChordLib.csv.

Member Data Documentation

◆ Degree

int MidiPlayerTK.MPTKChordBuilder.Degree

Scale degree from 1 to 7.

  • I Tonic First
  • II Supertonic Second
  • III Mediant Major or minor third
  • IV Subdominant Fourth
  • V Dominant Fifth
  • VI Submediant Major or minor sixth
  • VII Leading Tone/Subtonic Major or minor seventh Additional reading: https://lotusmusic.com/lm_chordnames.html