Harmonia.Chord
- Package
- purescript-harmonia
- Repository
- afcondon/purescript-harmonia
Harmonia.Chord — the harmonic vocabulary's recipe layer.
A DegreeChord is a scale-degree-relative chord recipe (numeral + quality
- tensions + optional slash);
realize :: Key -> DegreeChord -> Chordresolves it against a Key into a set of pitch classes (0..11). No voicing, no voice leading, no emit — those live inHarmonia.Voicing.
Design ground rules:
- Slash, not inversion. First-inversion of a triad is just a slash with the 3rd as bass.
- A chord can be arbitrary-size; polyphony budget is a sink concern.
- Tensions are absolute (major / perfect) intervals from the chord root.
Add 7is the major 7th; for a minor-7 chord use theMin7quality.Sharp n/Flat nshift the default by ±1.Sus nreplaces the 3rd. borrow Mode dcresolves the chord's root in a parallel mode (modal interchange); it only shifts the root lookup, not the tension arithmetic.
Pure Prelude/Data.* — no Effect, no FFI — so it compiles unchanged
under the JS backend and purerl (Erlang). See Harmonia.Voicing for the
concrete-pitch / voice-leading layer.
#DegreeChord Source
newtype DegreeChordConstructors
DegreeChord { mode :: Maybe Mode, numeral :: Numeral, quality :: Quality, slash :: Maybe Numeral, tensions :: Array Tension }
Instances
#numeralIndex Source
numeralIndex :: Numeral -> IntZero-based index into the mode's interval array.
#qualityIntervals Source
qualityIntervals :: Quality -> Array IntInterval set of a chord quality, in semitones from the root.
#modeIntervals Source
modeIntervals :: Mode -> Array IntSemitone offsets from the tonic for each scale degree.
#defaultIntervalFor Source
defaultIntervalFor :: Int -> Maybe IntDefault semitone offset for a numbered degree, measured from the chord root.
#chordRoot Source
chordRoot :: Key -> DegreeChord -> IntThe chord's ROOT pitch class against a Key — (tonic + mode-interval at
numeral) mod 12, honouring a borrowed-mode override. Same arithmetic
realize uses for the root; exposed so callers can GROUND a chord (put its
root in the bass) and LABEL it by its root rather than by the lowest
pitch-class of a sorted voicing.
#chordBass Source
chordBass :: Key -> DegreeChord -> IntThe pitch class a chord should sit on in the bass: its slash bass if slashed (e.g. I maj7/vii), else its root.
#slashed Source
slashed :: DegreeChord -> Numeral -> DegreeChordApply a slash bass to a chord recipe.
#borrow Source
borrow :: Mode -> DegreeChord -> DegreeChordBorrow this chord's root lookup from a parallel mode.
#mcmullenYellowNames Source
mcmullenYellowNames :: Array StringShort display names, parallel (index-for-index) to mcmullenYellow.
- Modules
- Harmonia.
Chord - Harmonia.
Voicing