Universal Music Theory Library - v0.12.0
    Preparing search index...

    Class Chord

    A chord: a root pitch plus a set of intervals defining the chord quality, within a tuning system.

    intervalsInSteps contains the offset in tuning steps from the root for each chord tone, including the root itself (offset 0) as the first element. Example: [0, 4, 7] = major triad in 12-TET (root, major third, perfect fifth).

    Index

    Constructors

    • Parameters

      • name: string

        Human-readable chord name (e.g. "Cmaj7", "Bb7", "G/B").

      • tuningSystem: TuningSystem

        The tuning system this chord operates in.

      • rootStep: number

        Step offset of the root from A4 (= 0).

      • intervalsInSteps: readonly number[]

        Intervals from the root for each chord tone, in tuning steps. Must include 0 (the root) as the first element.

      • OptionalbassStep: number

        Optional bass note step for slash chords (e.g. C/E). If provided and higher than the root, it is automatically moved an octave down.

      • OptionalpreferFlats: boolean

        Optional flat/sharp preference for note naming in getNotes(). When provided, overrides the root-name heuristic. Set by parseChordSymbol and PLR transforms for context-aware accidental spelling.

      Returns Chord

    Properties

    bassStep?: number

    Optional bass note step for slash chords (e.g. C/E). If provided and higher than the root, it is automatically moved an octave down.

    intervalsInSteps: readonly number[]

    Intervals from the root for each chord tone, in tuning steps. Must include 0 (the root) as the first element.

    name: string

    Human-readable chord name (e.g. "Cmaj7", "Bb7", "G/B").

    preferFlats?: boolean

    Optional flat/sharp preference for note naming in getNotes(). When provided, overrides the root-name heuristic. Set by parseChordSymbol and PLR transforms for context-aware accidental spelling.

    rootStep: number

    Step offset of the root from A4 (= 0).

    tuningSystem: TuningSystem

    The tuning system this chord operates in.

    Methods

    • Returns true if the given step (or its pitch class) is a tone of this chord. Comparison is by pitch class - octave is ignored.

      Parameters

      • step: number

      Returns boolean

    • Returns the notes of the chord in a specific inversion.

      Parameters

      • inversion: number

        0 = root position, 1 = 1st inversion, 2 = 2nd inversion, etc. Values ≥ notes.length wrap around (modulo). Slash chord bass notes participate in the inversion logic and may not stay at the bottom.

      Returns Note[]

    • Returns the notes of the chord in root position. In 12-TET each tone is named by its interval above the written root (D#m → D# F# A#; Cm7b5 → C Eb Gb Bb; C7#11 has F#). For slash chords, the bass note is prepended below the root.

      Returns Note[]

    • Returns the pitch classes of all chord tones as step offsets within one period (0 to octaveSteps - 1). Does not include the bass note of slash chords.

      Returns number[]

    • Returns the tritone substitution of this chord. Typically applied to dominant 7th chords (e.g., G7 -> Db7). In another tuning it is the same substitution, when every note of the chord and of the substitute stands for a 12-TET note (retune); otherwise null.

      Returns Chord | null

    • Returns a specific voicing of the chord.

      • close - notes in root position, as compact as possible (default stack).
      • drop2 - second note from the top dropped one octave (requires ≥ 4 voices).
      • drop3 - third note from the top dropped one octave (requires ≥ 4 voices).
      • rootless - root note omitted (common in jazz piano comping).
      • open - every other upper voice raised an octave (wider spacing).
      • quartal - notes stacked by fourths (approximate; 12-TET–optimised).

      Parameters

      • type: "close" | "drop2" | "drop3" | "rootless" | "open" | "quartal"

      Returns Note[]

    • The same chord in another tuning: each note goes to the step of tuning that stands for the same 12-TET note (TuningSystem.retuneStep). A Cmaj7 of 31-EDO becomes the Cmaj7 of 12-TET or of Werckmeister III; name and flat/sharp preference are kept.

      Parameters

      Returns Chord | null

      The chord in tuning, or null when one of its notes stands for no 12-TET note (a quarter tone) or tuning has no step for it.

    • Returns a new chord transposed by the given number of steps. The name follows: the root takes the spelling of the key with fewer accidentals, and a slash bass keeps its letter distance from the root (C/E +2 → D/F#; C/Bb +2 → D/C). By whole octaves the chord keeps its name.

      Parameters

      • steps: number

      Returns Chord

    • Voice Leading: Finds the inversion/voicing of this chord that requires the minimum total

      movement (in cents) from the current set of notes.

      Parameters

      Returns Note[]