Sustained Rhythm
ci / checks (push) Successful in 47m43s

This commit is contained in:
khodowany
2026-09-30 02:18:31 -05:00
parent 8a23fa0fc2
commit 923b7f14e2
826 changed files with 57641 additions and 35 deletions
+13
View File
@@ -4,6 +4,7 @@ import pathlib
import unittest
import unittest.mock
import generator.accompaniment
import generator.acoustic
import generator.arrange.generate
import generator.engraving.fonts
@@ -11,6 +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
@@ -108,6 +110,17 @@ 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):