Chords
Two paths to chordal patterns: the chord() function with chord-symbol literals (Am7, Cmaj7), and inline chord brackets in pat() strings ([c4 e4 g4]). For voi…
Two paths to chordal patterns: the chord() function with chord-symbol literals (Am7, Cmaj7), and inline chord brackets in pat() strings ([c4 e4 g4]). For voice leading, the anchor, mode, voicing, and addVoicings transforms reshape chord events into musical voicings.
chord
Chord pattern - Parse a string of chord symbols into a polyphonic event stream.
| Param | Type | Default | Description |
|---|---|---|---|
| str | string | - | Chord symbols separated by spaces |
// Major chord
chord("C") // C major triad
// Minor seventh
chord("Am7") // A minor seventh
// Chord progression
chord("Am C Dm G") // One chord per beat triad
A triad is a 3-note chord: root, third, fifth. Bare letter names (C, Am, F) parse as triads. Quality suffixes:
| Suffix | Meaning |
|---|---|
| (none) | Major triad |
m | Minor triad |
dim | Diminished |
aug | Augmented |
sus2 | Suspended 2 |
sus4 | Suspended 4 |
seventh
A seventh chord adds a 7th degree. Quality suffixes:
| Suffix | Meaning |
|---|---|
7 | Dominant 7 |
maj7 | Major 7 |
m7 | Minor 7 |
// Jazz progression
chord("Cmaj7 Am7 Dm7 G7") |> mtof(%) |> osc("saw", %) |> out(%, %) inline
Inline chords in pattern strings use square brackets: every note plays simultaneously rather than in sequence.
// C major as inline chord
pat("[c4 e4 g4]") // Mixed sequence and chord
pat("c4 [c4 e4 g4] e4 g4") anchor
anchor(pattern, "c4") sets the MIDI anchor note for chord voicing. Note names accept letter + optional accidental (# / b) + octave (c4, F#3, Bb-1).
// Voice the chords around c4
chord("Am C G F").anchor("c4") mode
mode(pattern, "below") sets the chord voicing mode:
below: all chord notes ≤ anchorabove: all chord notes ≥ anchorduck: closest to anchor, avoiding the anchor itselfroot: root in bass octave near anchor, rest stacked near anchor
// Voice-led progression, top note ≤ c4
chord("Am C G F").anchor("c4").mode("below")
|> mtof(%)
|> osc("saw", %)
|> out(%, %) voicing
voicing(pattern, "drop2") applies a named voicing dictionary. Built-in dictionaries:
close: all notes within an octaveopen: wide spacing, root on bottomdrop2: second-from-top dropped one octavedrop3: third-from-top dropped one octave
// Drop-2 voicing on a jazz progression
chord("Cmaj7 Am7 Dm7 G7").voicing("drop2") drop2
drop2: the second-highest note dropped down an octave. Classic guitar/piano jazz voicing.
drop3
drop3: the third-highest note dropped down an octave. Wider spread than drop2.
close
close: all notes packed within an octave. Tight, pad-like voicing.
open
open: root in bass, upper notes stacked widely. Broad, brassy voicing.
addVoicings
addVoicings("name", {quality: [intervals], ...}) registers a custom voicing dictionary by chord-quality name.
// Custom piano-jazz voicing
addVoicings("piano-jazz", {M: [0, 4, 7, 11, 14], m: [0, 3, 7, 10, 14]})
chord("CM Am Dm G").voicing("piano-jazz") Related: Mini-Notation Basics, Sequencing, poly