duncanmalashock/elm-music-theory/1.0.0

Music.Analysis

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.

type alias Analysis =
Analysis

Analysis

analyze : Chord -> Key -> Analysis

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 == vOfii

Converting to chords

toChord : DefaultChordTypes -> Key -> Analysis -> Chord

Convert to a chord in the specified key:

toChord triadsByDefault Key.f iii == Chord.minor PitchClass.a
triadsByDefault : DefaultChordTypes

Use triads when converting, if no chord type is specified:

toChord triadsByDefault Key.f iv == Chord.major PitchClass.bFlat

Triads are the default for harmonizing the scale in classical music.

seventhsByDefault : DefaultChordTypes

Use seventh chords when converting, if no chord type is specified:

toChord seventhsByDefault Key.f iv == Chord.majorSeventh PitchClass.bFlat

Seventh chords are the default for harmonizing the scale in jazz music.

Other conversions

toString : Key -> Analysis -> String

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.

Constructors

Diatonic scale degrees

i : Analysis
ii : Analysis
iii : Analysis
iv : Analysis
v : Analysis
vi : Analysis
vii : Analysis
withChordType : ChordType -> Analysis -> Analysis

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

Secondary dominants are dominant chords of a scale degree other than the tonic, e.g. A is the V/ii in C major.

vOfii : Analysis
vOfiii : Analysis
vOfiv : Analysis
vOfv : Analysis
vOfvi : Analysis

Chromatic scale degrees

Chromatic scale degrees require a chord type to be specified, since they have no defaults:

iSharp : ChordType -> Analysis
iiSharp : ChordType -> Analysis
iiiSharp : ChordType -> Analysis
ivSharp : ChordType -> Analysis
vSharp : ChordType -> Analysis
viSharp : ChordType -> Analysis
viiSharp : ChordType -> Analysis
iFlat : ChordType -> Analysis
iiFlat : ChordType -> Analysis
iiiFlat : ChordType -> Analysis
ivFlat : ChordType -> Analysis
vFlat : ChordType -> Analysis
viFlat : ChordType -> Analysis
viiFlat : ChordType -> Analysis