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

    Function chordPitchClasses

    • Get the sorted, deduplicated pitch classes of a chord.

      A slash bass is one of them: F/G sounds a G, the voicers put it in the bass, and a set that omitted it would not re-detect as the chord it came from. Pass includeBass: false to enumerate the interval template alone.

      Parameters

      • chord: ChordData

        The chord to enumerate.

      • opts: { includeBass?: boolean } = {}

        Set includeBass: false to omit a slash bass.

      Returns number[]

      The chord's pitch classes, sorted ascending in [0, 11].

      import { makeChord, chordPitchClasses } from '@libraz/libcantus';
      chordPitchClasses(makeChord(0, 'maj7')); // [0, 4, 7, 11]
      chordPitchClasses(makeChord(5, 'maj', 7)); // [0, 5, 7, 9] — F/G, G included