duncanmalashock/elm-music-theory/1.0.0

Music.ChordType

A chord type describes the factors contained in a chord, with no specific root pitch class. E.g. a "dominant seventh" chord.

type alias ChordType =
ChordType

Chord factors

Chord factors (such as the "third", "fifth", etc. of a chord) are represented as Intervals.

factors : ChordType -> List Interval

Get the factors contained in a chord type:

factors minor
    == [ Interval.perfectUnison
       , Interval.minorThird
       , Interval.perfectFifth
       ]
contains : Interval -> ChordType -> Bool

Determine whether a chord type contains a given factor:

contains Interval.diminishedFifth halfDiminishedSeventh == True

Categorizing factors

Categorize factors into certain useful data structures. Helpful when creating custom voicing methods.

categorizeFactors : ChordType -> Maybe CategorizedFactors

Categorize the factors in a chord type:

categorizeFactors minorSix
    == { third = Interval.minorThird
       , fifth = Interval.perfectFifth
       , sixthOrSeventh = Just Interval.majorSixth
       , ninth = []
       , eleventh = Nothing
       , thirteenth = Nothing
       }
type alias CategorizedFactors =
{ third : Interval
, fifth : Interval
, sixthOrSeventh : Maybe Interval
, ninth : List Interval
, eleventh : Maybe Interval
, thirteenth : Maybe Interval
}
availableTensions : ChordType -> Maybe AvailableTensions

Organize the factors in a chord type into their jazz-theory category and their possible substitutes, often known referred to as "available tensions".

availableTensions majorSeventh =
    { root =
        { true = Interval.perfectUnison
        , substitutes = [ Interval.majorSecond ]
        }
    , third =
        { true = Interval.majorThird
        , substitutes = []
        }
    , fifth =
        { true = Interval.perfectFifth
        , substitutes = []
        }
    , seventh =
        { true = Interval.majorSeventh
        , substitutes = []
        }
    }
type alias AvailableTensions =
{ root :
{ true : Interval
, substitutes : List Interval
}
, third :
{ true : Interval
, substitutes : List Interval
}
, fifth :
{ true : Interval
, substitutes : List Interval
}
, seventh :
{ true : Interval
, substitutes : List Interval
}
}

Conversion

toString : ChordType -> String

Get the chord symbol for a chord type:

toString majorSeventh == "M7"

Want more control over chord symbols? See the classify function.

Groups

Lists of commonly-grouped chord types. Note that these are incomplete, and only represent the chord types contained in this module, since there is no exhaustive list of all valid chord types in tonal music.

all : List ChordType

All the chord types listed in this module.

triads : List ChordType

All chord types with only a root, third (or suspension), and fifth.

sixthAndSeventhChords : List ChordType

All chord types with a sixth or seventh added to a triad.

majorChords : List ChordType

All chord types with a major quality.

minorChords : List ChordType

All chord types with a minor quality.

dominantChords : List ChordType

All chord types with a dominant quality.

alteredDominantChords : List ChordType

All chord types with a dominant quality that also have altered extensions.

Constructors

Triads

major : ChordType
minor : ChordType
augmented : ChordType
diminished : ChordType
sus2 : ChordType
sus4 : ChordType

Added-tone chords

majorSix : ChordType
majorSixNine : ChordType
minorSix : ChordType
minorSixNine : ChordType
majorAddNine : ChordType
minorAddNine : ChordType

Seventh chords

majorSeventh : ChordType
minorSeventh : ChordType
dominantSeventh : ChordType
diminishedSeventh : ChordType
minorMajorSeventh : ChordType

Chords with extensions

majorNinth : ChordType
minorNinth : ChordType
dominantNinth : ChordType
minorEleventh : ChordType
dominantEleventh : ChordType
dominantThirteenth : ChordType

Altered dominant chords

Seventh

Ninth

Thirteenth

Custom chord types

custom : ChordType

Define a custom chord type. Start with custom and apply the chord factor functions below:

custom
    |> withMinorThird
    |> withDiminishedFifth
    |> withMinorSeventh
-- equivalent to `halfDiminishedSeventh`

Note: because there is no unified model for naming any given chord, your custom chord may not work with the toString function in this module.

withMajorThird : ChordType -> ChordType
withMinorThird : ChordType -> ChordType
withSuspendedSecond : ChordType -> ChordType
withSuspendedFourth : ChordType -> ChordType
withFifth : ChordType -> ChordType
withSharpFifth : ChordType -> ChordType
withFlatFifth : ChordType -> ChordType
withSixth : ChordType -> ChordType
withMajorSeventh : ChordType -> ChordType
withMinorSeventh : ChordType -> ChordType
withDiminishedSeventh : ChordType -> ChordType
withNinth : ChordType -> ChordType
withSharpNinth : ChordType -> ChordType
withFlatNinth : ChordType -> ChordType
withEleventh : ChordType -> ChordType
withSharpEleventh : ChordType -> ChordType
withThirteenth : ChordType -> ChordType
withFlatThirteenth : ChordType -> ChordType

Custom chord symbols

classify : ChordType -> Classification

Get a chord type's classification:

classify dominantNinthFlatThirteen
    == Classification MajorTriad (Just MinorSeventh) Ninth [ MinorThirteenth ]

You can read more about how to use the Classification type in the Chord.Classification module.