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
-24
View File
@@ -12,7 +12,6 @@ import generator.fretboard
import generator.harmony
import generator.model
import generator.musicxml
import generator.rhythm
import tests.test_acoustic
import tests.test_accompaniment
@@ -263,26 +262,3 @@ class AcousticVoicingTests(unittest.TestCase):
document['staves'][0]['measures'][0]['staff_details']['capo'] = 1
with self.assertRaisesRegex(ValueError, 'capo'):
generator.acoustic_voicing.place(document)
def test_real_song_iterations_use_complete_upper_voices(self):
rhythms = generator.rhythm.load_library(pathlib.Path('data/rhythms'))
for path in sorted(pathlib.Path('data/songs').glob('*.xml')):
source = generator.musicxml.load_musicxml(path)
before = copy.deepcopy(source)
result = generator.arrange.generate.arrange_document(source, 'acoustic', rhythms=rhythms)
generator.model.validate_document(result)
self.assertEqual(source, before)
for measure in result['staves'][0]['measures']:
for voice in measure['voices']:
for note in voice['notes']:
upper = sorted(p['tablature']['string'] for p in note['pitches'] if p['tablature']['string'] <= 4)
self.assertIn(upper, ([], [2, 3, 4]))
frets = [p['tablature']['fret'] for p in note['pitches']]
if frets:
self.assertLessEqual(max(frets) - min(frets) + 1, 3)
self.assertTrue(all('tie_from' not in p and 'tie_to' not in p for p in note['pitches']))
if path.stem == 'autumn_leaves':
for index, expected in ((0, voicing((3, 2, 3, 3), 6)), (1, voicing((3, 2, 3, 2), 6)), (4, voicing((3, 2, 3, 3), 6)), (5, voicing((3, 2, 3, 2), 6))):
measure = result['staves'][0]['measures'][index]
actual = {p for v in measure['voices'] for n in v['notes'] for p in shape(n)}
self.assertEqual(actual, set(expected))
self.assertEqual(result, generator.arrange.generate.arrange_document(source, 'acoustic', rhythms=rhythms))