Class Interval
Interval between two notes, or to build a second note from the first.
Section
Section | Summary |
---|---|
Intervals | Interval constants |
Summary
Field | Type | Summary |
---|---|---|
Label | number | Label of the interval = diatonic degree If integer, one of IL_* constants (IL_UNISON to IL_OCTAVE). |
Octaves | int | Number of octaves for compound intervals. |
Quality | number | Interval quality (minor, major, diminished) If integer, one of IQ_* constants (IQ_MINOR, IQ_AUGMENTED...) |
Return type | Function and summary |
---|---|
Interval | new(int label, int quality, int octaves) Constructor of Interval object |
boolean | isPerfectQualityAllowed() Is perfect quality applicable for the label? |
string, string, int, int | secondNote(nameOrSymbol) Calculate the second note of the interval. |
number | semitones() 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, int octaves)
Constructor of Interval object
Parameter | Type | Default | Description |
---|---|---|---|
label | int | One of IL_* constants, from IL_UNISSON to IL_OCTAVE. If more than one octave, sum of 2 * IL_OCTAVE + IL_FIFTH | |
quality | int | One of IQ_* constants, e.g. IQ_PERFECT, IQ_MAJOR,IQ_MINOR, IQ_AUGMENTED, IQ_DOUBLE_DIMINISHED... | |
octaves | int | Octave shift, 0, +1, -1... |
- Return
- Interval: The interval object
Interval:isPerfectQualityAllowed()
Is perfect quality applicable for the label?
- Return
- boolean:
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: number
Interval:secondNote(nameOrSymbol)
Calculate the second note of the interval.
Parameter | Type | Default | Description |
---|---|---|---|
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