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

    Function voiceChord

    • Realize a single chord as one MIDI pitch per voice, ascending (index 0 = lowest). The bass voice takes the chord's bassPc when set, otherwise the root; upper voices take chord pitch classes, doubling the root or fifth as needed to fill all voices. The result stays inside each voice's range, keeps adjacent upper voices within maxSpacing, avoids voice crossing, and is deterministic: a compact close-position voicing centered in the ranges.

      Parameters

      Returns number[]

      MIDI pitches, ascending, one per voice.

      If no voicing fits the given ranges.

      import { parseChordSymbol, voiceChord } from '@libraz/libcantus';
      const chord = parseChordSymbol('Cmaj7');
      voiceChord(chord); // four ascending MIDI pitches within the SATB ranges