duncanmalashock / elm-music-theory / Music.Key

A key defines a relationship between a set of pitch classes in a composition. E.g. the "key of D major".


type alias Key =
Music.Internal.Key.Key

Helpers

tonic : Key -> Music.PitchClass.PitchClass

Get the tonic pitch class for a key:

tonic gMinor == PitchClass.g

scale : Key -> Music.Internal.Scale.Scale

Get the scale for a key:

scale aFlat == Scale.major PitchClass.aFlat

isMajor : Key -> Basics.Bool

Check whether a key is major:

isMajor bFlat == True

isMinor : Key -> Basics.Bool

Check whether a key is minor:

isMinor cSharpMinor == True

signature : Key -> List Music.PitchClass.PitchClass

Get the key signature for a key as a list of the pitch classes that are sharpened or flattened:

signature bFlat == [ PitchClass.bFlat, PitchClass.eFlat ]

Related keys

relative : Key -> Key

Get the relative minor or relative major of a key:

relative f == dMinor

relative cSharpMinor == e

parallel : Key -> Key

Get the parallel minor or parallel major of a key:

parallel f == fMinor

parallel cSharpMinor == cSharp

Conversion

toString : Key -> String

Get the name of a key:

toString eFlat == "E♭"

toString aMinor == "Am"

Constructors

Major keys

c : Key

f : Key

bFlat : Key

eFlat : Key

aFlat : Key

dFlat : Key

gFlat : Key

g : Key

d : Key

a : Key

e : Key

b : Key

fSharp : Key

Minor keys

aMinor : Key

dMinor : Key

gMinor : Key

cMinor : Key

fMinor : Key

bFlatMinor : Key

eFlatMinor : Key

eMinor : Key

bMinor : Key

fSharpMinor : Key

cSharpMinor : Key

gSharpMinor : Key