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

    Function parseChordSymbol

    • Parse a lead-sheet chord symbol into a Chord.

      Accepts <root><quality>[/<bass>], e.g. Cmaj7, F#m7b5, Bb7, C/G, C6/9, C6/9/E. Root and bass letters are case-insensitive, matching parseNote. A / is ambiguous between a slash bass and the 6/9 quality; the text splits at the last / whose right-hand side is a valid bare note preceded by a recognized quality, so 6/9 (with or without a further slash bass) parses as a quality.

      The parsed chord carries the root/bass spellings as enharmonic hints (rootSpelling/bassSpelling) so formatChordSymbol can reproduce flat spellings such as Bbmaj7 instead of respelling them with sharps.

      Parameters

      • text: string

        The chord symbol text.

      Returns ChordData

      The parsed chord.

      If the root or quality is not recognized.

      import { parseChordSymbol, formatChordSymbol } from '@libraz/libcantus';
      const c = parseChordSymbol('Bbmaj7');
      formatChordSymbol(c); // 'Bbmaj7' — flat spelling is preserved on round-trip