Accompaniment
ci / checks (push) Successful in 49m53s

This commit is contained in:
khodowany
2026-10-06 01:59:55 -05:00
parent 04bb44b9d0
commit df83cae38c
14 changed files with 916 additions and 156 deletions
+8 -3
View File
@@ -33,6 +33,7 @@ def audit(source, documents):
if part == 'vocal':
continue
sections = generator.arrange.form.full_arrangement_sections(authored, part)
entry_positions = {s.source_measure_index for s in sections if s.role == 'accompaniment'}
measures = document['staves'][0]['measures']
carried = generator.accompaniment.carried_chords(measures)
seen, exceptions, offset, reused = {}, [], 0, 0
@@ -45,10 +46,14 @@ def audit(source, documents):
if j == section.measure_count - 1 and following and following.role == 'melody' and generator.arrange.pickup.enters(following, authored):
exceptions.append({'measure': m['number'], 'reason': 'protected melody pickup'})
continue
if j == section.measure_count - 1 and following and following.role == 'slash' and generator.score.body_start_measure_index(authored):
exceptions.append({'measure': m['number'], 'reason': 'source-defined solo pickup allocation'})
continue
position = section.source_measure_index + j
key = (section.source_measure_index + j, repr(harmonic_key(m, carried[offset + j])))
signature = tuple((generator.model.fraction(n['onset']), generator.model.fraction(n['duration']),
tuple((generator.model.pitch_number(p), p['tablature']['string'], p['tablature']['fret']) for p in n['pitches']))
for n in generator.score.measure_notes(m))
signature = tuple((v['id'], generator.model.fraction(n['onset']), generator.model.fraction(n['duration']),
tuple((generator.model.pitch_number(p), generator.model.fraction(p['duration']), p['tablature']['string'], p['tablature']['fret'], bool(p.get('tie_from')) if position not in entry_positions or generator.model.fraction(n['onset']) else False) for p in n['pitches']))
for v in m['voices'] for n in v['notes'] if n['pitches'])
if key in seen:
if signature != seen[key]:
raise ValueError(f'{part}, arrangement measure {m["number"]}: canonical accompaniment changed')