Add voice crossing check - reject edges where voices cross
- Movement map must be identity (0->0, 1->1, 2->2) to pass - If any voice moves to a different position, weight = 0
This commit is contained in:
parent
d4cdd86e85
commit
e13e9ba3bc
|
|
@ -830,10 +830,14 @@ class PathFinder:
|
||||||
if edge_data.get("is_directly_tunable", False):
|
if edge_data.get("is_directly_tunable", False):
|
||||||
w *= 10
|
w *= 10
|
||||||
|
|
||||||
# Voice crossing weight (prefer no crossing)
|
# Voice crossing check - reject edges where voices cross
|
||||||
if config.get("voice_crossing", False):
|
if config.get("voice_crossing", False):
|
||||||
# Simplified: prefer edges where more pitches stay in order
|
# Check if movement map is identity (0->0, 1->1, 2->2, etc.)
|
||||||
w *= 10
|
# If any voice moves to a different position, that's a crossing
|
||||||
|
num_voices = len(edge[0].pitches)
|
||||||
|
is_identity = all(movements.get(i) == i for i in range(num_voices))
|
||||||
|
if not is_identity:
|
||||||
|
w = 0.0 # Reject edges with voice crossing
|
||||||
|
|
||||||
weights.append(w)
|
weights.append(w)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue