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

    Function explainRoman

    • Render a chord as a Roman numeral and say how the numeral was arrived at.

      The numeral is exactly what chordToRoman returns for the same arguments — this is that function with its reasoning attached, for teaching material and for any interface whose users argue with the analysis. The rationale names the degree the root was spelled as, the quality that set the numeral's case and suffix, and what became of the bass, including the two cases where a bass exists and no numeral can carry it.

      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: ExplainRomanOptions = {}

        The rendering options of chordToRoman, plus alternatives to collect the spellings they turned down.

      Returns RomanExplanation

      The numeral, its rationale, and the rejected spellings.

      import { explainRoman, makeChord, majorKey } from '@libraz/libcantus';
      explainRoman(makeChord(7, 'dom7'), majorKey(0)).rationale;
      // 'V7: the root is the fifth degree of the key, the case and suffix come from the dom7 quality, and the chord stands on its own root'
      const applied = explainRoman(makeChord(2, 'dom7'), majorKey(0), { alternatives: true });
      applied.alternatives?.map((rejected) => rejected.label); // ['V7/V']