Fix Generation
ci / checks (push) Successful in 1h10m16s

This commit is contained in:
khodowany
2026-09-26 23:28:13 -05:00
parent 3beeb87549
commit a416a80dd9
6 changed files with 36 additions and 19 deletions
+2 -1
View File
@@ -15,6 +15,7 @@ import generator.pitch
STANDARD_TUNING = ((6, 40), (5, 45), (4, 50), (3, 55), (2, 59), (1, 64))
MIN_FRET = 0
MAX_FRET = 20
PREFERRED_MAX_FRET = 12
MAX_FRET_SPAN = 4
WRITTEN_GUITAR_OCTAVE_OFFSET = 12
ACOUSTIC_STRINGS = ((6, 4, 3), (6, 4, 3, 2), (5, 4, 3), (5, 3, 2), (5, 4, 3, 2))
@@ -44,7 +45,7 @@ def voicing_cost(positions: tuple[TabPosition, ...], profile: str = '', allowed:
classes = {p.midi % 12 for p in positions}
above = sum(p.midi > max(melody) for p in positions) if melody else 0
span = compactness(positions)
effort = 2 * max(frets, default=0) + span
effort = 2 * max(0, max(frets, default=0) - PREFERRED_MAX_FRET) + span
if profile == 'acoustic':
effort += 2 * span + 2 * max(0, len(frets) - 1)
return VoicingCost(max(0, 4 - len(positions)) if profile == 'electric' else 0,