A scale is a set of pitch classes in a certain order. E.g. the "C major scale."
Get the root pitch class of a scale:
root (major PitchClass.eFlat) == PitchClass.eFlatGet the scale type for a scale:
scaleType (lydian PitchClass.c) == ScaleType.lydianGet the pitch classes contained in the scale:
toList (major PitchClass.f)
== [ PitchClass.f
, PitchClass.g
, PitchClass.a
, PitchClass.bFlat
, PitchClass.c
, PitchClass.d
, PitchClass.e
]Find out whether a scale contains a given pitch class:
containsPitchClass PitchClass.f
{ ignoreSpelling = False }
(major PitchClass.c)
== TrueSet the ignoreSpelling flag to allow enharmonic equivalents. This returns True because G♭ is not in C Lydian, but F♯ (an equivalent) is:
containsPitchClass PitchClass.gFlat
{ ignoreSpelling = True }
(lydian PitchClass.c)
== TrueFind out whether a scale contains a given chord:
containsChord (Chord.majorSeventhSharpEleven PitchClass.f)
(major PitchClass.c)
== TrueGet all chords contained in a scale, choosing from a list of chord types to detect:
allChords [ ChordType.minorSeventh ] (major PitchClass.c)
== [ Chord.minorSeventh PitchClass.d
, Chord.minorSeventh PitchClass.e
, Chord.minorSeventh PitchClass.a
]Get a degree of the scale:
degree 3 (major PitchClass.c) == PitchClass.eNote: like many numbers in music theory, degrees are 1-based; 2 means the second degree of the scale. 0 and negative integers are ignored.
Get a mode of a scale by shifting the order of its pitch classes. For example, E Phrygian is the third mode of the C major scale:
mode 3 (major PitchClass.c) == phrygian PitchClass.eNote: like many numbers in music theory, modes are 1-based; 2 means the second mode of the scale type. 0 and negative integers are ignored.
Same as ionian
Also known as the "natural minor" scale. Same as aeolian
Create a scale from a custom scale type. For use with ScaleType.customPentatonic, ScaleType.customHexatonic, ScaleType.customHeptatonic, and ScaleType.customOctatonic:
myCustomScaleType =
customPentatonic
{ rootToSecond = Interval.minorThird
, rootToThird = Interval.perfectFourth
, rootToFourth = Interval.perfectFifth
, rootToFifth = Interval.minorSeventh
}
myCustomScale =
|> custom PitchClass.c myCustomScaleType
-- Equivalent to `minorPentatonic PitchClass.c`