Total voice-leading cost between two voicings: the sum of absolute semitone
motion across voices, plus a moderate HIDDEN_PERFECT_PENALTY when the
outer-voice (bass–soprano) pair reaches a hidden/direct perfect fifth or
octave by similar motion. 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 (plus any hidden-perfect penalty), or
Infinity when lengths differ.
Total voice-leading cost between two voicings: the sum of absolute semitone motion across voices, plus a moderate HIDDEN_PERFECT_PENALTY when the outer-voice (bass–soprano) pair reaches a hidden/direct perfect fifth or octave by similar motion. The arrays must be the same length; when they differ the voicings are not comparable and the cost is
Infinity.