def test_2(self): xml_path = path + '_test_2.xml' sf_1 = SimpleFormat(quarter_durations=[1, 2, 3, 2, 1], midis=[60, (60, 62), (64, 66, 71), 72, 73]) sf_1.to_stream_voice().add_to_score(self.score) sf_2 = SimpleFormat(quarter_durations=[0.5, 1, 1.5, 2, 3], midis=[0, 69, (72, 73), (58, 60, 65, 71), 80]) sf_2.to_stream_voice().add_to_score(self.score, staff_number=2) sf_3 = SimpleFormat.sum(sf_1, sf_2, no_doubles=True) sf_3.to_stream_voice().add_to_score(self.score, staff_number=3) self.score.write(xml_path) self.assertCompareFiles(xml_path)
def test_3(self): xml_path = path + '_test_3.xml' score = TreeScoreTimewise() gw = GearWheels(wheels=[Wheel(3), Wheel(4), Wheel(5)]) sfs = [] for index, wheel in enumerate(gw.wheels): quarter_durations = xToD(wheel.get_position_values()) midis = len(quarter_durations) * [60 + index] sf = SimpleFormat(quarter_durations=quarter_durations, midis=midis) sfs.append(sf) sf.to_stream_voice().add_to_score(score, part_number=index + 1) sf = SimpleFormat.sum(*sfs) sf.to_stream_voice().add_to_score(score, part_number=len(gw.wheels) + 1) score.write(xml_path) self.assertCompareFiles(xml_path)
def test_3(self): xml_path = path + '_test_3.xml' sf_1 = SimpleFormat(quarter_durations=[1, 2, 3, 2, 1], midis=[60, (60, 62), (64, 66, 71), 72, 73]) sf_2 = SimpleFormat(quarter_durations=[0.5, 1, 1.5, 2, 3], midis=[0, 69, (72, 73), (58, 60, 65, 71), 80]) sf_3 = SimpleFormat(quarter_durations=[1.5, 1.5, 1.5], midis=[(55, 58), 0, 57]) sfs = [sf_1, sf_2, sf_3] for index, sf in enumerate(sfs): sf.to_stream_voice().add_to_score(self.score, staff_number=index + 1) sum_sf = SimpleFormat.sum(*sfs, no_doubles=True) sum_sf.to_stream_voice().add_to_score(self.score, staff_number=len(sfs) + 1) self.score.write(xml_path) self.assertCompareFiles(xml_path)