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

    Function scalesForChanges

    • Choose one scale per chord across a progression, favoring continuity.

      Each chord's chordScales candidates form a stage in a Viterbi-style dynamic program. The transition cost between adjacent choices is the number of pitch classes that differ between their pitch-class sets (the symmetric difference), plus a small penalty for straying from a chord's best-fit scale so that ties break toward the tighter fit. The minimum-total-cost path is returned, one ScaleChoice per input chord in the original order.

      Parameters

      • chords: ChordData[]

        The chord sequence to choose scales for.

      Returns ScaleChoice[]

      One scale choice per chord, in input order.