Scale Patterns
ci / checks (push) Successful in 48m15s

This commit is contained in:
khodowany
2026-09-30 03:17:06 -05:00
parent 7cad6db980
commit f5f0ab5eec
31 changed files with 626 additions and 32 deletions
+9
View File
@@ -285,3 +285,12 @@ def validate_document(document: dict) -> None:
for span in staves[0].get('octave_shifts', []):
if not 0 <= fraction(span['start']) < fraction(span['end']) <= absolute or not -3 <= span['octaves'] <= 3:
raise ValueError('invalid octave-shift span')
previous_end = fractions.Fraction()
for span in staves[0].get('scale_spans', []):
start, end = fraction(span['start']), fraction(span['end'])
if not previous_end <= start < end <= absolute or not isinstance(span.get('label'), str) or not span['label'].strip() or type(span.get('matched')) is not bool:
raise ValueError('invalid solo scale span')
if not isinstance(span.get('id'), str) or not span['id'] or span['id'] in ids:
raise ValueError('solo scale spans require unique IDs')
ids.add(span['id'])
previous_end = end