MCC
Loading...
Searching...
No Matches

Key signatures, keys in the seven diatonic modes and spelling in a key. More...

Collaboration diagram for Key:

Classes

class  MCC::Key
 A tonic and a diatonic mode, with the key signature they imply. More...
class  MCC::KeySignature
 Key signature: zero to seven sharps or flats (SPEC-KEY-1). More...

Enumerations

enum class  MCC::KeyMode : uint8_t {
  Lydian = 0 , Major , Mixolydian , Dorian ,
  Minor , Phrygian , Locrian
}
 Diatonic mode of a key, ordered from brightest to darkest.

Detailed Description

Key signatures, keys in the seven diatonic modes and spelling in a key.

MCC::KeySignature stores zero to seven sharps or flats as a position on the circle of fifths. MCC::Key pairs a tonic with an MCC::KeyMode and derives its signature, so E minor has one sharp and D Dorian has none; Key::FromSignature() goes the other way. Key::Spell() writes a pitch class, or a sounding chromatic index, in the key's context: diatonic notes use the key's letters, and chromatic notes are raised in sharp keys and lowered in flat keys. See Music-Domain Specification (SPEC-KEY-*).

const MCC::Key key(MCC::NoteName(MCC::Letter::E), MCC::KeyMode::Minor);
key.Signature().Sharps(); // 1
key.Spell(MCC::PitchClass(3)); // D# (sharp key)
MCC::Key(MCC::NoteName(MCC::Letter::F), MCC::KeyMode::Major)
.Spell(MCC::PitchClass(3)); // Eb (flat key)
A tonic and a diatonic mode, with the key signature they imply.
Definition Key.h:46
MCC_CONSTEXPR14 NoteName Spell(MCC::PitchClass pitchClass) const noexcept
Writes pitchClass in this key's context (SPEC-KEY-3).
Definition Key.h:116
Written note name: a letter plus an accidental, without octave.
Definition NoteName.h:29
Pitch class 0-11 with spelling discarded (C = 0).
Definition PitchClass.h:21

Available when MCC_KEY is defined. Requires the Scale module.