Fret Limit
This commit is contained in:
@@ -103,7 +103,7 @@ def cells(plan, measures, rhythms, choices=()):
|
||||
|
||||
@functools.lru_cache(maxsize=2048)
|
||||
def scale_options(scale, allowed, low, high):
|
||||
return tuple(generator.solo.types.scale_pitch(scale, index) for index in range(-21, 28) if low <= generator.solo.types.scale_pitch(scale, index).number() <= high and generator.solo.types.scale_pitch(scale, index).number() % 12 in allowed and generator.fretboard.positions_for_pitch(fractions.Fraction(generator.solo.types.scale_pitch(scale, index).number())))
|
||||
return tuple(generator.solo.types.scale_pitch(scale, index) for index in range(-21, 28) if low <= generator.solo.types.scale_pitch(scale, index).number() <= high and generator.solo.types.scale_pitch(scale, index).number() % 12 in allowed and generator.fretboard.single_positions_for_pitch(fractions.Fraction(generator.solo.types.scale_pitch(scale, index).number())))
|
||||
|
||||
def valid_notes(notes, choices):
|
||||
return all(n.pitch.number() % 12 in generator.solo.types.permitted(choices, n.start, n.end) for n in notes)
|
||||
@@ -111,7 +111,7 @@ def valid_notes(notes, choices):
|
||||
def options(choices, start, end, register):
|
||||
scale = next((c.scale for c in choices if c.span.start <= start < c.span.end), None)
|
||||
allowed = generator.solo.types.permitted(choices, start, end)
|
||||
return scale_options(scale, allowed, max(41, register[0] - 7), min(84, register[1] + 5)) if scale and allowed else ()
|
||||
return scale_options(scale, allowed, *generator.fretboard.single_register((register[0] - 7, register[1] + 5))) if scale and allowed else ()
|
||||
|
||||
def target_ok(notes, target):
|
||||
return target is None or any(target.earliest <= n.start <= target.latest and n.pitch.number() % 12 in target.pitches for n in notes)
|
||||
|
||||
Reference in New Issue
Block a user