Training Model

This commit is contained in:
khodowany
2026-10-05 19:44:33 -05:00
parent db7966a430
commit e7180e557b
6603 changed files with 8919 additions and 523063 deletions
+2 -16
View File
@@ -12,9 +12,7 @@ import generator.engraving.layout
import generator.engraving.types
import generator.model
import generator.playback
import generator.rhythm
import tests.arrangement_fixtures
import tests.rhythm_fixtures
import tests.test_accompaniment
import tests.test_musicxml
import tests.test_parts
@@ -110,17 +108,6 @@ class AcousticTests(unittest.TestCase):
notes = self.combine(acoustic_document([([(0, fractions.Fraction(5, 2))], [])]))[0]
self.assertEqual([n['written'] for n in notes], [{'type': 'half', 'dots': 0}, {'type': 'half', 'dots': 0}])
self.assertEqual(tests.test_accompaniment.timing(notes), [(0, 2, 'note'), (2, 2, 'rest')])
def test_harmony_clipping_waits_for_combined_attacks_before_shortening(self):
content = tests.test_parts.xml_harmony() + tests.test_parts.xml_harmony('F', offset=13) + tests.test_musicxml.xml_note(duration=16)
source = tests.test_musicxml.parse(tests.test_accompaniment.xml_bars([content], divisions=4))
bass = generator.rhythm.Bar((generator.rhythm.Event(fractions.Fraction(), fractions.Fraction(4), True, 'whole'),), fractions.Fraction(4))
upper = generator.rhythm.Bar((generator.rhythm.Event(fractions.Fraction(), fractions.Fraction(3), False, 'half', 1), generator.rhythm.Event(fractions.Fraction(3), fractions.Fraction(1), True, 'quarter')), fractions.Fraction(4))
plan = generator.accompaniment.Plan((bass,), (upper,), ())
result = tests.arrangement_fixtures.section_document(source, 'acoustic', rhythms=tests.rhythm_fixtures.library(), plan=plan)
generator.model.validate_document(result)
notes = tests.test_musicxml.notes(result)
self.assertEqual(tests.test_accompaniment.timing(notes), [(0, 3, 'note'), (3, fractions.Fraction(1, 4), 'note'), (fractions.Fraction(13, 4), fractions.Fraction(3, 4), 'rest')])
self.assertEqual(notes[0]['written'], {'type': 'half', 'dots': 1})
def test_unrelated_voices_and_solo_slashes_are_unchanged(self):
document = acoustic_document([([(0, 4)], [(0, 4)])])
for part in ('electric', 'vocal', None):
@@ -138,11 +125,10 @@ class AcousticTests(unittest.TestCase):
self.assertEqual(document, before)
def test_song_and_section_integration_preserve_playback(self):
source = tests.test_musicxml.parse(tests.test_musicxml.xml_score(tests.test_parts.xml_harmony() + tests.test_musicxml.xml_note()))
rhythms = tests.rhythm_fixtures.library()
for builder in (generator.arrange.generate.arrange_document, tests.arrangement_fixtures.section_document):
with unittest.mock.patch('generator.acoustic.combine'):
separate = builder(source, 'acoustic', rhythms=rhythms)
combined = builder(source, 'acoustic', rhythms=rhythms)
separate = builder(source, 'acoustic')
combined = builder(source, 'acoustic')
self.assertEqual(sounding(separate), sounding(combined))
generator.model.validate_document(combined)
self.assertTrue(all(len(m['voices']) == 1 for m in combined['staves'][0]['measures']))