diff --git a/compact_sets.py b/compact_sets.py index e1df171..e82c30f 100644 --- a/compact_sets.py +++ b/compact_sets.py @@ -830,10 +830,14 @@ class PathFinder: if edge_data.get("is_directly_tunable", False): w *= 10 - # Voice crossing weight (prefer no crossing) + # Voice crossing check - reject edges where voices cross if config.get("voice_crossing", False): - # Simplified: prefer edges where more pitches stay in order - w *= 10 + # Check if movement map is identity (0->0, 1->1, 2->2, etc.) + # 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)