Roman numeral analysis describes the relationship of a chord to a key. E.g. E minor is the "iii" chord in the key of C major.
Analyze a chord in the context of a given key:
analyze (Chord.minor PitchClass.e) Key.c == iii
analyze (Chord.major PitchClass.a) Key.c == vOfiiConvert to a chord in the specified key:
toChord triadsByDefault Key.f iii == Chord.minor PitchClass.aUse triads when converting, if no chord type is specified:
toChord triadsByDefault Key.f iv == Chord.major PitchClass.bFlatTriads are the default for harmonizing the scale in classical music.
Use seventh chords when converting, if no chord type is specified:
toChord seventhsByDefault Key.f iv == Chord.majorSeventh PitchClass.bFlatSeventh chords are the default for harmonizing the scale in jazz music.
Get the symbol for a Roman numeral analysis:
toString Key.c iv == "IV"
toString Key.cMinor iv == "iv"
toString Key.c (viiFlat ChordType.majorSeventh) == "♭VIIM7"The Key parameter is used to determine whether to render the symbol in the context of a major or minor key.
Diatonic scale degrees have default chords types in major or minor scales. This function lets you use others:
iii
|> withChordType ChordType.majorSeventh
|> toString -- "IIImaj7"Secondary dominants are dominant chords of a scale degree other than the tonic, e.g. A is the V/ii in C major.
Chromatic scale degrees require a chord type to be specified, since they have no defaults: