duncanmalashock / elm-music-theory / 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 =
Music.Internal.Analysis.Analysis

Analysis

analyze : Music.Chord.Chord -> Music.Internal.Key.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 : Music.Internal.Analysis.DefaultChordTypes -> Music.Internal.Key.Key -> Analysis -> Music.Chord.Chord

Convert to a chord in the specified key:

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

triadsByDefault : Music.Internal.Analysis.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 : Music.Internal.Analysis.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 : Music.Internal.Key.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 : Music.ChordType.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 : Music.ChordType.ChordType -> Analysis

iiSharp : Music.ChordType.ChordType -> Analysis

iiiSharp : Music.ChordType.ChordType -> Analysis

ivSharp : Music.ChordType.ChordType -> Analysis

vSharp : Music.ChordType.ChordType -> Analysis

viSharp : Music.ChordType.ChordType -> Analysis

viiSharp : Music.ChordType.ChordType -> Analysis

iFlat : Music.ChordType.ChordType -> Analysis

iiFlat : Music.ChordType.ChordType -> Analysis

iiiFlat : Music.ChordType.ChordType -> Analysis

ivFlat : Music.ChordType.ChordType -> Analysis

vFlat : Music.ChordType.ChordType -> Analysis

viFlat : Music.ChordType.ChordType -> Analysis

viiFlat : Music.ChordType.ChordType -> Analysis