def test_11(self): cfg = ChordField( duration_generator=ValueGenerator( RandomInterpolation(start=[0.25, 0.25, 0.5], end=[0.5, 0.75, 1], seed=20))) cf_1 = ChordField( quarter_duration=3, midi_generator=ValueGenerator(cycle([60, 61, 64, 66]))) cf_2 = ChordField( quarter_duration=6, midi_generator=ValueGenerator(cycle([72, 73, 74, 73, 72])), long_ending_mode='self_extend') cfg.add_child(cf_1) cfg.add_child(cf_2) xml_path = path + 'test_11.xml' copied = cfg.__deepcopy__() copied.simple_format.to_stream_voice().add_to_score(self.score) self.score.write(xml_path) self.assertCompareFiles(xml_path)
breathe.midi_generator = ValueGenerator(cycle([60])) ### parent_chord_field = ChordField( duration_generator=breathe.duration_generator.__deepcopy__()) # parent_chord_field = ChordField( # duration_generator=ValueGenerator(iter(list(breathe.duration_generator.__deepcopy__())))) for i in range(len(quarter_durations)): quarter_duration = quarter_durations[i] midi = 60 + i parent_chord_field.add_child( ChordField(midi_generator=ValueGenerator(cycle([midi])), long_ending_mode='self_extend', short_ending_mode='self_shrink', quarter_duration=quarter_duration)) #### copy_parent_chord_field = parent_chord_field.__deepcopy__() #### #### breathe.simple_format.to_stream_voice().add_to_score(score=score, part_number=1) parent_chord_field.simple_format.to_stream_voice().add_to_score(score=score, part_number=2) # print(sum([fractal_tree.quarter_duration for fractal_tree in copy_parent_chord_field.children])) # # print(copy_parent_chord_field.children[0].simple_format.quarter_duration) # print(([float(fractal_tree.quarter_duration) for fractal_tree in copy_parent_chord_field.children])) # print(float(copy_parent_chord_field.children[0].simple_format.quarter_duration)) # print(([float(fractal_tree.quarter_duration) for fractal_tree in copy_parent_chord_field.children])) # print(float(copy_parent_chord_field.children[1].simple_format.quarter_duration))