コード例 #1
0
    def parse_tones_poly(self, filename, model_name):
        notes = Staff()
        # remove measure and tacts
        notes.remove_commands.append('Time_signature_engraver')
        notes.remove_commands.append('Bar_engraver')

        mala_voice = ""
        vela_voice = ""
        tones_dict = self.get_tones_dict_poly()
        for mala_tone, tone_length in tones_dict['m']:
            duration = self.get_duration_label(tone_length)

            if duration:
                mala_voice += mala_tone + duration + " "

        for vela_tone, tone_length in tones_dict['v']:
            duration = self.get_duration_label(tone_length)

            if duration:
                vela_voice += vela_tone + duration + " "

        mala_voice = Voice(mala_voice, name='mala voice')
        literal = LilyPondLiteral(r'\voiceOne')
        attach(literal, mala_voice)

        vela_voice = Voice(vela_voice, name='vela voice')
        literal = LilyPondLiteral(r'\voiceTwo')
        attach(literal, vela_voice)

        container = Container([mala_voice, vela_voice])
        container.is_simultaneous = True
        notes.append(container)

        PersistenceManager(client=notes).as_pdf(
            os.path.join(SHEETS_DIR, model_name, filename))
コード例 #2
0
    def parse_tones_mono(self, filename, model_name):
        notes = Staff()
        # remove measure and tacts
        notes.remove_commands.append('Time_signature_engraver')
        notes.remove_commands.append('Bar_engraver')

        for tone, tone_length in self.get_tones_dict_mono():
            duration = self.get_duration_label(tone_length)

            if duration:
                tone += duration

                notes.append(tone)

        PersistenceManager(client=notes).as_pdf(
            os.path.join(SHEETS_DIR, model_name, filename))