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

    Function romanToChord

    • Build the chord denoted by a Roman numeral in a key.

      Supports accidentals (bVII, #iv), case-based triad quality, the o/ø/+ suffixes, sevenths (V7, viio7, Imaj7), figured-bass inversions (V6, V64, V65, V43, V42), and applied/secondary chords via a slash (V7/V, viio/ii). The target after the slash is read as a scale degree whose root becomes a local major tonic for the applied chord. Inverted chords carry a bassPc.

      The ø glyph always denotes the half-diminished seventh (iiø == iiø7 == m7b5), since no half-diminished triad exists. Extension and added-tone suffixes are the canonical case-sensitive forms emitted by chordToRoman and honor the numeral case: V9 -> dom9, ii9 -> min9, Imaj9 -> maj9, V11 -> 11, V13 -> 13, Iadd6/iadd6 -> 6/min6, I69 -> 6/9, Isus2/Isus4, Iadd9/Iadd11, Ib5 -> majb5, I5 -> 5, and the altered dominants V7b9/V7#9/V7#11/V7b13. A figure string that is neither a recognized inversion nor a supported quality suffix throws rather than silently degrading to a triad.

      Parameters

      • text: string

        The Roman numeral.

      • key: KeyScale

        The prevailing key.

      Returns ChordData

      The chord.

      import { romanToChord, majorKey } from '@libraz/libcantus';
      romanToChord('V7', majorKey(0)); // G7 in C major: { rootPc: 7, quality: 'dom7', ... }