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

    Function detectChord

    • Identify chords matching a set of pitches.

      Every input pitch class is tried as a root against every known chord quality. A match is reported when all of the chord's tones are present in the input, or when the only absent tone is the perfect fifth (a common omission in shell voicings); matches are ranked best-first by fewest extra notes, then fewest missing notes, then most specific (largest) chord. An exact match (no extras, no missing) is flagged and ranked first.

      Parameters

      • pitches: number[]

        MIDI pitches or bare pitch classes (octave-agnostic).

      • opts: DetectChordOptions = {}

      Returns ChordMatch[]

      Ranked chord interpretations (may be empty).

      import { detectChord } from '@libraz/libcantus';
      const matches = detectChord([60, 64, 67]); // C E G
      matches[0]; // { rootPc: 0, quality: 'maj', exact: true, ... }