duncanmalashock/elm-music-theory/1.0.0

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

Helpers

tonic : Key -> PitchClass

Get the tonic pitch class for a key:

tonic gMinor == PitchClass.g
scale : Key -> Scale

Get the scale for a key:

scale aFlat == Scale.major PitchClass.aFlat
isMajor : Key -> Bool

Check whether a key is major:

isMajor bFlat == True
isMinor : Key -> Bool

Check whether a key is minor:

isMinor cSharpMinor == True
signature : Key -> List 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
eMinor : Key
bMinor : Key