@libraz/libcantus - v1.1.0
    Preparing search index...

    Function chordToRoman

    • Render a chord as a Roman numeral relative to a key.

      Diatonic roots take their scale-degree numeral directly, so numerals are correct in both major and minor keys (and any custom scale). The quality selects the case and suffix; chromatic roots receive a flat/sharp spelling by convention. A key that is not heptatonic has no numeral of its own for every degree, so its roots are named against its parallel major.

      When the chord carries a bassPc on a chord tone, a figured-bass inversion (6, 64, 65, 43, 42) is emitted for plain triads and true seventh chords; added-tone and extended qualities have no lossless figure and render in root position instead (the bass is dropped, pitch classes are preserved).

      A bassPc that is not a chord tone — a pedal or passing bass such as C/D — is likewise dropped, and the numeral names the upper chord alone. Roman-numeral notation spends its slash on applied chords (V7/V), so there is no unambiguous way to write such a bass; a caller that must keep it should read chord.bassPc alongside the numeral.

      A chord sounding one of the augmented sixths over an explicit bass on the lowered submediant renders as It6, Fr6 or Ger6, since no numeral names those chords; see augmentedSixthKind for exactly when that applies. That reading is made against the key as written, because what separates an augmented sixth from the seventh chord it sounds like is its letters: the German sixth of Ab minor is named from the Fb Ab Cb D it is written with, not from the letters those pitch classes take once the key has been respelled as a G# minor.

      Parameters

      • chord: ChordLike

        The chord to name, as a chord symbol, chord data, or a Chord.

      • key: KeyLike

        The prevailing key, as a key name, a key/scale, or a Key.

      • opts: ChordToRomanOptions = {}

        applied renders tonicizing chords as V7/V-style numerals; neapolitan renders a first-inversion Neapolitan as N6.

      Returns string

      The Roman numeral string.

      import { chordToRoman, makeChord, majorKey } from '@libraz/libcantus';
      chordToRoman(makeChord(7, 'dom7'), majorKey(0)); // => 'V7' (G7 in C major)
      chordToRoman(makeChord(2, 'dom7'), majorKey(0), { applied: true }); // => 'V7/V'

      explainRoman for the same numeral with the reasoning behind it.