Get a chord's type:
chordType (dominantSeventh PitchClass.a) == ChordType.dominantSeventhGet a chord's root:
root (dominantSeventh PitchClass.a) == PitchClass.aDetermine whether a chord contains a given pitch class:
containsPitchClass PitchClass.cSharp (major PitchClass.a) == TrueDetect chords that contain the given pitch classes:
detect
[ ChordType.majorSix
, ChordType.minorSeventh
]
[ PitchClass.a
, PitchClass.c
, PitchClass.e
, PitchClass.g
]
== [ minorSeventh PitchClass.a
, majorSix PitchClass.c
]Passing in a list of chord types to detect is required, since there exists no exhaustive list of valid chords in tonal music.
Get the pitch classes in a chord:
toPitchClasses (major PitchClass.a)
== [ PitchClass.a
, PitchClass.cSharp
, PitchClass.e
]Note: for converting a chord to pitches, I recommend looking at the functions in the Voicing chords section below.
Get the chord symbol for a chord:
toString (dominantNinth PitchClass.a) == "A9"Looking for more flexibility? Look at ChordType.classify.
A chord is defined by a set of pitch classes. But pitch classes can't be heard; only pitches can be. "Voicing" a chord is the process of:
Learn more about how this works in the Voicing.ThreePart, Voicing.FourPart, and Voicing.FivePart modules.
Create a chord from a custom chord type. For use with ChordType.custom:
myCustomChordType =
ChordType.custom
|> ChordType.withMinorThird
|> ChordType.withDiminishedFifth
|> ChordType.withMinorSeventh
myCustomChord =
|> custom PitchClass.c myCustomChordType
-- Equivalent to `halfDiminishedSeventh PitchClass.c`You can also use custom to construct a chord from a chord type, in cases where the chord type may vary:
custom PitchClass.c ChordType.majorSeventh
== Chord.majorSeventh PitchClass.c