Fix voice stay count to match master behavior
Changed voice stay count calculation in Path.step() to compare by position (position i with position i) instead of tracking voice identity. This makes dca_voice_movement factor behave identically to master.
This commit is contained in:
parent
f2b785c98e
commit
c682a1df02
3987
session-ses_328e.md:q
Normal file
3987
session-ses_328e.md:q
Normal file
File diff suppressed because one or more lines are too long
23
src/path.py
23
src/path.py
|
|
@ -97,26 +97,11 @@ class Path:
|
||||||
for node in self._node_visit_counts:
|
for node in self._node_visit_counts:
|
||||||
self._node_visit_counts[node] += 1
|
self._node_visit_counts[node] += 1
|
||||||
|
|
||||||
# Update voice stay counts (comparing same voice, not position)
|
# Update voice stay counts (matching master: compare position i with position i)
|
||||||
for voice_idx in range(len(self._voice_stay_count)):
|
for voice_idx in range(len(self._voice_stay_count)):
|
||||||
# Find which position this voice was at in previous chord
|
curr_cents = prev_output_chord.pitches[voice_idx].to_cents()
|
||||||
prev_voice_pos = None
|
next_cents = output_chord.pitches[voice_idx].to_cents()
|
||||||
for pos, voice in enumerate(self._voice_map):
|
if curr_cents == next_cents:
|
||||||
if voice == voice_idx:
|
|
||||||
prev_voice_pos = pos
|
|
||||||
break
|
|
||||||
|
|
||||||
# Current position of this voice
|
|
||||||
curr_voice_pos = voice_idx
|
|
||||||
|
|
||||||
if prev_voice_pos is not None:
|
|
||||||
prev_cents = prev_output_chord.pitches[prev_voice_pos].to_cents()
|
|
||||||
else:
|
|
||||||
prev_cents = None
|
|
||||||
|
|
||||||
curr_cents = output_chord.pitches[curr_voice_pos].to_cents()
|
|
||||||
|
|
||||||
if prev_cents is not None and prev_cents == curr_cents:
|
|
||||||
self._voice_stay_count[voice_idx] += 1
|
self._voice_stay_count[voice_idx] += 1
|
||||||
else:
|
else:
|
||||||
self._voice_stay_count[voice_idx] = 0
|
self._voice_stay_count[voice_idx] = 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue