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_7(self):
        fm = FractalMusic(tempo=60,
                          proportions=[1, 2, 3, 4],
                          tree_permutation_order=[3, 1, 4, 2],
                          quarter_duration=20)
        fm.midi_generator.midi_range = [60, 79]
        fm.add_layer()
        fm.chord.add_words(fm.midi_generator.midi_range)

        for child in fm.get_children():
            child.chord.add_lyric(child.fractal_order)
            child.chord.add_words(child.midi_generator.midi_range)

        for index, node in enumerate(fm.get_children()):
            node.midi_generator.midi_range = [60 - index, 72 - index]

        fm.add_layer()
        for leaf in fm.traverse_leaves():
            leaf.chord.add_lyric(leaf.fractal_order)

        score = TreeScoreTimewise()

        for layer_number in range(0, fm.number_of_layers + 1):
            simple_format = fm.get_simple_format(layer_number)

            v = simple_format.to_stream_voice(1)
            v.add_to_score(score, layer_number + 1)

        xml_path = path + '_test_7.xml'
        score.accidental_mode = 'normal'
        score.write(xml_path)
        self.assertCompareFiles(actual_file_path=xml_path)
Ejemplo n.º 3
0
    def get_score_template(self):
        score = TreeScoreTimewise()
        score.tuplet_line_width = 2.4
        score.page_style.orientation = 'landscape'
        score.page_style.system_distance = 180
        score.page_style.staff_distance = 150
        score.page_style.top_system_distance = 150
        score.page_style.bottom_margin = 100

        score.add_title('module: {}'.format(self.name))
        rounded_duration = round(float(self.duration), 1)
        if rounded_duration == int(rounded_duration):
            rounded_duration = int(rounded_duration)

        clock = Timing.get_clock(rounded_duration, mode='msreduced')
        score.add_subtitle('duration: {}'.format(clock))
        score.accidental_mode = 'modern'
        return score