Soloing
ci / checks (push) Successful in 50m39s

This commit is contained in:
khodowany
2026-10-01 06:31:14 -05:00
parent ce695a626a
commit eae432aa83
29 changed files with 1402 additions and 158 deletions
+4 -1
View File
@@ -56,7 +56,7 @@ def following_indices(timeline: tuple[generator.scales.timeline.ChordSpan, ...])
result[index] = result[index + 1] if same else index + 1
return result
def select(timeline: tuple[generator.scales.timeline.ChordSpan, ...], solo: generator.scales.timeline.Solo, library: generator.scales.library.Library) -> tuple[Choice, ...]:
def select(timeline: tuple[generator.scales.timeline.ChordSpan, ...], solo: generator.scales.timeline.Solo, library: generator.scales.library.Library, *, retained: tuple = ()) -> tuple[Choice, ...]:
collections = library.collections()
following = following_indices(timeline)
rows, layers = [], []
@@ -77,6 +77,9 @@ def select(timeline: tuple[generator.scales.timeline.ChordSpan, ...], solo: gene
if target.pitches == home.pitches:
target = home
required = set(generator.harmony.pitch_classes(span.chord)) if span.chord else set()
for start, end, pitches in retained:
if start < span.end and end > span.start:
required.update(pitches)
options = [target if scale.pitches == target.pitches else home if scale.pitches == home.pitches else scale for scale in collections if required <= scale.pitches] if span.chord else []
options = options or [None]
layer = []