Fix Generation

This commit is contained in:
khodowany
2026-09-26 22:59:14 -05:00
parent 83154b1a01
commit 3beeb87549
9 changed files with 239 additions and 9 deletions
+9 -1
View File
@@ -179,7 +179,15 @@ class AccompanimentPlanningTests(unittest.TestCase):
measures = tests.test_musicxml.parse(xml_bars([content] * 4))['staves'][0]['measures']
plan = generator.accompaniment.plan_section(measures, library)
self.assertEqual(plan.acoustic_upper, (sounding,) * 4)
self.assertEqual(plan.electric, (silent,) * 4)
self.assertEqual(plan.electric, (sounding,) * 4)
def test_electric_density_targets_two_stabs_per_four_quarter_beats(self):
library = tests.rhythm_fixtures.library()
for beats in (2, 3, 4, 5):
with self.subTest(beats=beats):
plan = generator.accompaniment.plan_section(melody_measures(4, beats=beats), library)
for bar in plan.electric[:3]:
self.assertIn(len(bar.attacks()), {beats // 2, (beats + 1) // 2})
self.assertLessEqual(len(plan.electric[3].attacks()), (beats + 1) // 2 + 1)
def test_section_repeats_four_bar_motif_with_at_most_one_beat_variation(self):
for beats in (2, 3, 4, 5):
measures = melody_measures(12, beats=beats, dense=True)