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

    Function nextVoicing

    • Voice a single chord to follow smoothly from an arbitrary current voicing.

      Candidate voicings of chord are enumerated within ranges taken from opts, or — when neither voices nor ranges is given — from a one-octave window around each pitch of current (so the result matches current's voice count). Each candidate is scored by structural quality, voice-leading motion from current, and a large penalty per counterpoint violation; the lowest scoring candidate is returned, ascending.

      The rules read from the chord being left — the resolution of a chordal seventh, the resolution of a leading tone, and the cross relation between the two chords — are scored only when opts.previousChord names it: what a voicing is written on cannot be read back from the pitches it holds. An editor moving from one chord to the next has that chord, and passing it is what keeps this generator and checkPartWriting agreeing about the pair.

      Parameters

      • current: number[]

        The current voicing to lead from, ascending (index 0 = lowest).

      • chord: ChordLike

        The next chord to voice, as a chord symbol, chord data, or a Chord.

      • Optionalopts: VoicingOptions

        Voicing options; when omitted, ranges follow current's span.

      Returns number[]

      The chosen voicing, ascending with one MIDI pitch per voice.

      If current is empty or holds a non-finite pitch while the ranges are derived from it, if it asks for more voices than the search will take, or if no voicing fits the ranges.