Sizing
ci / checks (push) Successful in 47m22s

This commit is contained in:
khodowany
2026-09-30 02:49:54 -05:00
parent 923b7f14e2
commit 7cad6db980
17 changed files with 1443 additions and 1298 deletions
+5 -2
View File
@@ -14,6 +14,8 @@ class MeasureOrigin:
onset: fractions.Fraction
role: str
measure: dict
start: fractions.Fraction = fractions.Fraction()
end: fractions.Fraction | None = None
@dataclasses.dataclass(frozen=True)
class VoicingLink:
@@ -33,9 +35,10 @@ def link_voicings(source: list[dict], origins: list[MeasureOrigin]) -> list[Voic
for origin in origins:
for voice in origin.measure['voices']:
for note in voice['notes']:
if '_harmony' not in note:
local = generator.model.fraction(note['onset'])
if '_harmony' not in note or local < origin.start or (origin.end is not None and local >= origin.end):
continue
onset = origin.onset + generator.model.fraction(note['onset'])
onset = origin.onset + local
span = bisect.bisect_right(boundaries, onset)
if origin.role == 'melody' and note.get('_harmonize'):
melody.setdefault(span, []).append((onset, note['_harmony'], note))