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

    Function analyzeChord

    • Analyze a chord in a key: harmonic function, borrowing, and Roman numeral.

      The function is quality-aware (see the predicates behind it), the source follows borrowedSource, and the numeral comes from chordToRoman. borrowed is true whenever a source is identified, which includes the Neapolitan: it belongs to neither parallel mode, and both this and isBorrowedChord count it as a borrowing all the same.

      The rationale says which of those rules settled the function, so a reader who disagrees can see what the reading rests on. alternatives is empty unless asked for, and then names the readings that were turned down.

      Parameters

      • chord: ChordLike

        The chord to analyze, 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: AnalyzeChordOptions = {}

        Options used when rendering the Roman numeral, plus alternatives to collect the rejected readings.

      Returns ChordAnalysis

      The chord analysis.

      import { analyzeChord, makeChord, majorKey } from '@libraz/libcantus';
      analyzeChord(makeChord(7, 'dom7'), majorKey(0));
      // { function: 'dominant', borrowed: false, source: null, roman: 'V7', ... }
      analyzeChord(makeChord(9, 'dom7'), majorKey(0), { alternatives: true }).alternatives;
      // [{ label: 'tonic by scale degree', reason: '...' }, ...]