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

    Function voiceLeadingCost

    • Total voice-leading cost between two voicings: the sum of absolute semitone motion across voices, and nothing besides. The rules the search also weighs — parallels, hidden perfects, unresolved tendency tones — are judged and reported by checkPartWriting, so measuring distance stays a measurement. The arrays must be the same length; when they differ the voicings are not comparable and the cost is Infinity.

      Parameters

      • from: number[]

        The previous voicing, one MIDI pitch per voice.

      • to: number[]

        The next voicing, one MIDI pitch per voice.

      Returns number

      The summed absolute motion, or Infinity when lengths differ.