+4
-6
@@ -31,7 +31,6 @@ class VoicingCost(typing.NamedTuple):
|
||||
covered_melody: int = 0
|
||||
covering_tones: int = 0
|
||||
effort: int = 0
|
||||
simplicity: int = 0
|
||||
missing_tones: int = 0
|
||||
def plus(self, other: VoicingCost) -> VoicingCost:
|
||||
return VoicingCost(*(a + b for a, b in zip(self, other)))
|
||||
@@ -47,11 +46,10 @@ def voicing_cost(positions: tuple[TabPosition, ...], profile: str = '', allowed:
|
||||
span = compactness(positions)
|
||||
effort = 2 * max(0, max(frets, default=0) - PREFERRED_MAX_FRET)
|
||||
if profile in ('acoustic', 'electric'):
|
||||
effort += max(frets, default=0)
|
||||
simplicity = 3 * span + 2 * max(0, len(frets) - 1) if profile == 'acoustic' else 0
|
||||
if profile != 'acoustic':
|
||||
effort += max(frets, default=0) + 3 * span + 2 * max(0, len(frets) - 1)
|
||||
else:
|
||||
effort += span
|
||||
return VoicingCost(max(0, 4 - len(positions)) if profile == 'electric' else 0, int(bool(above)), above, effort, simplicity, len(set(allowed) - classes))
|
||||
return VoicingCost(max(0, 4 - len(positions)) if profile == 'electric' else 0, int(bool(above)), above, effort, len(set(allowed) - classes))
|
||||
|
||||
def within_fret_span(positions) -> bool:
|
||||
frets = [position.fret for position in positions]
|
||||
@@ -385,7 +383,7 @@ def advance_attacks(candidates, states: dict) -> dict:
|
||||
def advance_acoustic(candidates, states: dict) -> dict:
|
||||
result = {}
|
||||
for candidate in candidates:
|
||||
cost, _, previous = min((p.cost.moved(acoustic_movement(tuple(position for _, position in p.active), candidate.shape)), i, p) for i, p in enumerate(states.values()))
|
||||
cost, _, previous = min((p.cost.moved(2 * acoustic_movement(tuple(position for _, position in p.active), candidate.shape)), i, p) for i, p in enumerate(states.values()))
|
||||
result[candidate.active] = Placement(cost.plus(candidate.cost), candidate.active, previous, candidate.choices)
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user