Class Interval

Interval between two notes, or to build a second note from the first.

Section

SectionSummary
IntervalsInterval constants

Summary

FieldTypeSummary
LabelnumberLabel of the interval = diatonic degree If integer, one of IL_* constants (IL_UNISON to IL_OCTAVE).
OctavesintNumber of octaves for compound intervals.
QualitynumberInterval quality (minor, major, diminished) If integer, one of IQ_* constants (IQ_MINOR, IQ_AUGMENTED...)
Return typeFunction and summary
Intervalnew(int label, int quality)
Constructor of Interval object
boolisPerfectQualityAllowed()
Is perfect quality applicable for the label?
string, string, int, intsecondNote(nameOrSymbol)
Calculate the second note of the interval.
numbersemitones()
Return the semitones covered by this interval.

Fields

int Interval:Octaves

Number of octaves for compound intervals.

i.e. ninth is octave+second -> 1 octave.

number Interval:Label

Label of the interval = diatonic degree If integer, one of IL_* constants (IL_UNISON to IL_OCTAVE).

number Interval:Quality

Interval quality (minor, major, diminished) If integer, one of IQ_* constants (IQ_MINOR, IQ_AUGMENTED...)

Methods

Interval:new(int label, int quality)

Constructor of Interval object

ParameterTypeDefaultDescription
labelint One of IL_* constants, from IL_UNISSON to IL_OCTAVE. If more than one octave, sum of 2 * IL_OCTAVE + IL_FIFTH
qualityint One of IQ_* constants, e.g. IQ_PERFECT, IQ_MAJOR,IQ_MINOR, IQ_AUGMENTED, IQ_DOUBLE_DIMINISHED...
Return
Interval: The interval object

Interval:isPerfectQualityAllowed()

Is perfect quality applicable for the label?

Return
bool: true if unisson, fourth, fifth and octave, false otherwise.

Interval:semitones()

Return the semitones covered by this interval.

for example 0 for unison, 3 for minor third, 7 for perfect fifth...

Return
number:

Interval:secondNote(nameOrSymbol)

Calculate the second note of the interval.

ParameterTypeDefaultDescription
nameOrSymbol  string Note name in English (for example "C#", "Eb") or Symbol.
Returns
string: Anglo-saxon second note's name, that may be NOT compatible with MyrScript Symbol.AngloSaxonName, such as Bb-1, C10...
string: Anglo-saxon second note's name, always compatible with MyrScript Symbol.AngloSaxonName, such as 11 for B-1, and always in 0 (C-1)..127 (G9) bounds.
int: pitch Pitch between 0 and 127, 60=C4
int: Accidental constant from MSDefine (NATURAL, FLAT, SHARP...) for the note