Simplification
This commit is contained in:
@@ -25,24 +25,9 @@ class Instrument:
|
||||
def permits(self, number):
|
||||
return any(p.string_number in self.strings for p in generator.fretboard.single_positions_for_pitch(F(number)))
|
||||
|
||||
def cost(self, number):
|
||||
return .5 * min(1., max(0, abs(number - self.reference) - 7) / 12) if self.reference is not None else 0.
|
||||
|
||||
|
||||
UNRESTRICTED = Instrument()
|
||||
|
||||
|
||||
def weighted_center(notes):
|
||||
values = sorted((n.pitch.number(), n.end - n.start) for n in notes)
|
||||
total = sum((d for _, d in values), F())
|
||||
elapsed = F()
|
||||
for number, duration in values:
|
||||
elapsed += duration
|
||||
if elapsed >= total / 2:
|
||||
return number
|
||||
return 60
|
||||
|
||||
|
||||
def for_part(part, analysis=None):
|
||||
if part not in ('acoustic', 'electric'):
|
||||
raise ValueError('unknown solo instrument: ' + part)
|
||||
|
||||
Reference in New Issue
Block a user