ekzhang / harmony

🎶 Generate four-part harmony following idiomatic voice-leading procedures with DP!
https://autoharmony.herokuapp.com
BSD 3-Clause "New" or "Revised" License
47 stars 5 forks source link

Adding penalization to identical contiguous voicing #10

Open napulen opened 3 years ago

napulen commented 3 years ago

Dealing with #9.

Slight penalization on repeated voicings (cost = 2).

Tested with this example (a slight variation of the original example, 3 repeated harmonies):

parser.set_defaults(
        key="B-",
        chord_progression="I I IV IV ii V V I",
        durations="1 1/2 1 1/2 1 1/2 1/2 1",
        time_signature="6/8",
)

Without penalization: image

With penalization: image

Notice that the third repeated pair, V and V, was voiced identically (not always changing the voicing, which may be desired), but the first two changed.

Second version sounds much better in my opinion.