Ejemplo n.º 1
0
    def test_10(self):
        fm = FractalMusic(proportions=[1, 2, 3],
                          tree_permutation_order=[3, 1, 2])
        fm.tempo = 60
        fm.duration = 10
        fm.midi_generator.midi_range = (60, 72)
        fm.permute_directions = True
        fm.midi_generator.set_directions(-1, 1, -1)

        fm.add_layer()

        for node in fm.traverse():
            node.chord.add_lyric(node.midi_generator.directions)
            node.chord.add_words(node.children_generated_midis, relative_y=30)
            node.chord.add_words(node.midi_generator.midi_range, relative_y=60)

        fm.add_layer()

        score = TreeScoreTimewise()
        score.accidental_mode = 'modern'
        score = fm.get_score(score)
        score.page_style.staff_distance = 150
        xml_path = path + '_test_10.xml'
        score.write(xml_path)
        self.assertCompareFiles(xml_path)
Ejemplo n.º 2
0
    def test_change_midi_range_afterwards(self):

        fm = FractalMusic(proportions=[1, 2, 3],
                          tree_permutation_order=[3, 1, 2])
        fm.tempo = 60
        fm.duration = 10
        fm.midi_generator.midi_range = [40, 50]
        fm.add_layer()
        fm.add_layer()
        fm.reset_midis()
        fm.midi_generator.midi_range = [60, 70]
        expected = [62.0, 65.0, 60.0, 67.0, 69.0, 70.0, 67.0, 65.0, 69.0]
        actual = [l.midi_value for l in fm.traverse_leaves()]
        self.assertEqual(expected, actual)