|
MCC
|
Directed intervals and spelling-preserving transposition. More...

Classes | |
| class | MCC::Interval |
| Directed interval: a diatonic step count and a chromatic semitone count (SPEC-INT-1). More... | |
| class | MCC::IntervalNumber |
| 1-based interval number: 1 unison, 3 third, 8 octave, 10 tenth (SPEC-INT-2, SPEC-INT-3). More... | |
| class | MCC::IntervalQuality |
| Interval quality: perfect, major, minor, or augmented/diminished repeated one to four times (SPEC-INT-4). More... | |
Enumerations | |
| enum class | MCC::IntervalDirection : int8_t { Descending = -1 , Unison = 0 , Ascending = 1 } |
| Direction of an interval (SPEC-INT-2). More... | |
| enum class | MCC::IntervalQualityKind : uint8_t { Diminished = 0 , Minor = 1 , Perfect = 2 , Major = 3 , Augmented = 4 } |
| Kind of an interval quality. | |
Functions | |
| constexpr bool | MCC::IsEnharmonic (Interval a, Interval b) noexcept |
| Returns true when a and b are valid and span the same signed number of semitones: an ascending augmented fourth and an ascending diminished fifth are enharmonic. Any invalid operand yields false. | |
| MCC_CONSTEXPR14 Interval | MCC::IntervalBetween (Pitch from, Pitch to) noexcept |
| Returns the directed interval from from to to (SPEC-INT-1): the difference of their diatonic and chromatic indices. B#3 to C4 is an ascending diminished second; C4 to Cb4 is a descending augmented unison (SPEC-INT-5). | |
| MCC_CONSTEXPR14 Interval | MCC::IntervalBetween (NoteName from, NoteName to) noexcept |
| Returns the interval from from up to the next to, which is a simple ascending interval of 0-6 steps: B to C is a minor second and E to C is a minor sixth. Between two spellings of the same letter the result is a unison, descending when to is lower (C to Cb, SPEC-INT-5). | |
| MCC_CONSTEXPR14 Pitch | MCC::operator+ (Pitch pitch, Interval interval) noexcept |
| Transposes pitch by interval preserving spelling (SPEC-INT-7): the letter moves by the diatonic steps and the accidental is whatever the semitones require. E4 + major third = G#4; B3 + minor second = C4. | |
| MCC_CONSTEXPR14 Pitch | MCC::operator- (Pitch pitch, Interval interval) noexcept |
| Transposes pitch down by interval: pitch + interval.Reversed(). | |
| MCC_CONSTEXPR14 NoteName | MCC::operator+ (NoteName noteName, Interval interval) noexcept |
| Transposes a note name by interval preserving spelling (SPEC-INT-7): E + major third = G#, B + minor second = C. Octaves in the interval do not change a note name. | |
| MCC_CONSTEXPR14 NoteName | MCC::operator- (NoteName noteName, Interval interval) noexcept |
| Transposes a note name down by interval. | |
Directed intervals and spelling-preserving transposition.
MCC::Interval stores a diatonic step count and a semitone count, from which its MCC::IntervalDirection, MCC::IntervalNumber and MCC::IntervalQuality are derived. MCC::IntervalBetween() measures the interval between two pitches or note names, and pitch + interval transposes while preserving spelling: E4 + M3 = G#4, never Ab4. See Music-Domain Specification (SPEC-INT-*).
Available when MCC_INTERVAL is defined. Requires the Pitch module.
|
strong |
Direction of an interval (SPEC-INT-2).
The direction follows the written letters: an interval whose second letter is higher is ascending even if it is a diminished interval. Only the perfect unison has direction Unison; an augmented unison is ascending or descending (SPEC-INT-5).
Returns the directed interval from from to to (SPEC-INT-1): the difference of their diatonic and chromatic indices. B#3 to C4 is an ascending diminished second; C4 to Cb4 is a descending augmented unison (SPEC-INT-5).
The result is invalid when either pitch is invalid or the quality would need more than four augmentations or diminutions (for example Cbbbb4 to C####4).
Transposes a note name by interval preserving spelling (SPEC-INT-7): E + major third = G#, B + minor second = C. Octaves in the interval do not change a note name.
The result is invalid when an operand is invalid or the accidental would leave [-4, +4] (SPEC-ACC-3).
Transposes pitch by interval preserving spelling (SPEC-INT-7): the letter moves by the diatonic steps and the accidental is whatever the semitones require. E4 + major third = G#4; B3 + minor second = C4.
The result is invalid when an operand is invalid, the accidental would leave [-4, +4] (SPEC-ACC-3) or the octave would leave [-128, 127] (SPEC-OCT-4).