@libraz/libcantus - v0.9.3
    Preparing search index...

    Class Chord

    An immutable chord: a root pitch class, quality, interval template, and optional slash bass, optionally carrying a Key context. Analysis methods (roman, function, analyze, ...) use an explicitly passed key first and fall back to the carried context.

    import { Chord } from '@libraz/libcantus';
    Chord.parse('Cmaj7').invert(1).symbol(); // 'Cmaj7/E' (third in the bass)
    Index
    • get rootPc(): number

      The root pitch class (0..11).

      Returns number

    • get intervals(): number[]

      A copy of the semitone offsets above the root.

      Returns number[]

    • get bassPc(): number | undefined

      The slash-chord bass pitch class, or undefined in root position.

      Returns number | undefined

    • Build a chord from a root and quality.

      Parameters

      • root: string | number

        Root as a note name (e.g. 'Eb') or a pitch class.

      • quality: ChordQuality

        The chord quality.

      • Optionalbass: number

        Optional slash-chord bass pitch class.

      Returns Chord

      The chord (without key context).

    • Parse a lead-sheet chord symbol (e.g. 'Cmaj7', 'F#m7b5', 'C/G').

      Parameters

      • symbol: string

        The chord symbol.

      Returns Chord

      The chord (without key context).

      If the root or quality is not recognized.

    • Identify the chords matching a set of pitches, best interpretation first.

      Parameters

      Returns Chord[]

      Ranked chord interpretations (may be empty).

    • The single best chord interpretation of a pitch set.

      Parameters

      Returns Chord | null

      The top-ranked chord, or null when nothing matches.

    • A copy of this chord carrying the given key context.

      Parameters

      • key: Key

        The key context to attach.

      Returns Chord

      The new chord.

    • The chord's sorted, deduplicated pitch classes.

      Returns number[]

      Pitch classes ascending in [0, 11].

    • The chord's Roman numeral in a key.

      Parameters

      • Optionalkey: Key

        Key to analyze in; falls back to the carried context.

      Returns string

      The Roman numeral string.

      If no key is given and none is carried.

    • The chord's harmonic function (tonic / subdominant / dominant) in a key.

      Parameters

      • Optionalkey: Key

        Key to analyze in; falls back to the carried context.

      Returns HarmonicFunction

      The harmonic function.

      If no key is given and none is carried.

    • Full functional analysis: function, borrowing, and Roman numeral.

      Parameters

      • Optionalkey: Key

        Key to analyze in; falls back to the carried context.

      Returns ChordAnalysis

      The chord analysis.

      If no key is given and none is carried.

    • Whether the chord is borrowed from the parallel mode (modal interchange).

      Parameters

      • Optionalkey: Key

        Key to analyze in; falls back to the carried context.

      Returns boolean

      True if the chord is borrowed.

      If no key is given and none is carried.

    • The origin of a non-diatonic chord (parallel mode or Neapolitan), or null.

      Parameters

      • Optionalkey: Key

        Key to analyze in; falls back to the carried context.

      Returns BorrowedSource

      The borrowing source, or null.

      If no key is given and none is carried.

    • The chord rendered as a lead-sheet symbol (e.g. 'Cmaj7', 'F#m7', 'C/G').

      Parameters

      • Optionalopts: { flats?: boolean }

        Set flats: true to spell the root/bass with flats.

      Returns string

      The chord symbol.

    • Realize the chord as one MIDI pitch per voice, ascending.

      Parameters

      • Optionalopts: VoicingOptions

        Voicing options; defaults to four SATB voices.

      Returns number[]

      MIDI pitches, ascending, one per voice.

      If no voicing fits the given ranges.

    • Realize the chord as a single styled voicing (close, drop2, drop3, shell, or rootless), optionally constraining the top voice.

      Parameters

      Returns number[]

      MIDI pitches, ascending.

    • The negative-harmony mirror of the chord about the key's tonic–dominant axis (major becomes minor and vice versa).

      Parameters

      • Optionalkey: Key

        Key providing the reflection axis; falls back to the carried context.

      Returns Chord

      The mirrored chord, keeping any key context.

      If no key is given and none is carried.

    • The n-th inversion: a copy whose bass is the chord tone n steps above the root in the interval template (invert(1) puts the third in the bass). n wraps around the template length; negative values count backwards.

      invert(0) (and any n that wraps to it) is root position, so it carries no slash bass and equals the original chord.

      Parameters

      • n: number

        The inversion number.

      Returns Chord

      The inverted chord, keeping any key context.

      If the chord has no intervals.

    • The available tensions (usable non-chord, non-avoid scale tones) of a scale over this chord.

      Parameters

      • scaleName: string

        A named scale, rooted on the chord root.

      Returns number[]

      Tension pitch classes, ascending in [0, 11].

    • The avoid notes (scale tones a semitone above a chord tone) of a scale over this chord.

      Parameters

      • scaleName: string

        A named scale, rooted on the chord root.

      Returns number[]

      Avoid-note pitch classes, ascending in [0, 11].

    • Spell the chord tones with letter names, root first, in the key's spelling.

      Parameters

      • Optionalkey: Key

        Key providing the spelled tonic; falls back to the carried context.

      Returns Note[]

      Spelled octave-less notes in the chord's own (tertian) order.

      If no key is given and none is carried.

    • Start a progression with this chord followed by others, carrying this chord's key context (if any).

      Parameters

      • ...others: Chord[]

        The chords following this one.

      Returns Progression

      The progression.

    • Whether another chord has the same root, quality, intervals, and bass. Key context is not compared.

      Parameters

      • other: Chord

        The chord to compare.

      Returns boolean

      True if the chord data is identical.