Exemplo n.º 1
0
    def __call__(self):
        r'''Calls string orchestra template.

        Returns score.
        '''

        ### TAGS ###

        tag_names = []

        ### SCORE ###

        staff_group = scoretools.StaffGroup(name='Outer Staff Group', )

        score = scoretools.Score(
            [staff_group],
            name='Score',
        )

        ### VIOLINS ###

        if self.violin_count:
            clef_name = 'treble'
            if self.use_percussion_clefs:
                clef_name = 'percussion'
            instrument = instrumenttools.Violin()
            instrument_count = self.violin_count
            instrument_staff_group, instrument_tag_names = \
                self._make_instrument_staff_group(
                    clef_name=clef_name,
                    count=instrument_count,
                    instrument=instrument,
                    )
            staff_group.append(instrument_staff_group)
            tag_names.extend(instrument_tag_names)

        ### VIOLAS ###

        if self.viola_count:
            clef_name = 'alto'
            if self.use_percussion_clefs:
                clef_name = 'percussion'
            instrument = instrumenttools.Viola()
            instrument_count = self.viola_count
            instrument_staff_group, instrument_tag_names = \
                self._make_instrument_staff_group(
                    clef_name=clef_name,
                    count=instrument_count,
                    instrument=instrument,
                    )
            staff_group.append(instrument_staff_group)
            tag_names.extend(instrument_tag_names)

        ### CELLOS ###

        if self.cello_count:
            clef_name = 'bass'
            if self.use_percussion_clefs:
                clef_name = 'percussion'
            instrument = instrumenttools.Cello()
            instrument_count = self.cello_count
            instrument_staff_group, instrument_tag_names = \
                self._make_instrument_staff_group(
                    clef_name=clef_name,
                    count=instrument_count,
                    instrument=instrument,
                    )
            staff_group.append(instrument_staff_group)
            tag_names.extend(instrument_tag_names)

        ### BASSES ###

        if self.contrabass_count:
            clef_name = 'bass_8'
            if self.use_percussion_clefs:
                clef_name = 'percussion'
            instrument = instrumenttools.Contrabass()
            instrument_count = self.contrabass_count
            instrument_staff_group, instrument_tag_names = \
                self._make_instrument_staff_group(
                    clef_name=clef_name,
                    count=instrument_count,
                    instrument=instrument,
                    )
            staff_group.append(instrument_staff_group)
            tag_names.extend(instrument_tag_names)

        ### TIME SIGNATURE CONTEXT ###

        time_signature_context = scoretools.Context(
            name='TimeSignatureContext',
            context_name='TimeSignatureContext',
        )
        instrument_tags = ' '.join(tag_names)
        tag_string = "tag #'({})".format(instrument_tags)
        tag_command = indicatortools.LilyPondCommand(tag_string, 'before')
        attach(tag_command, time_signature_context)

        score.insert(0, time_signature_context)

        return score
Exemplo n.º 2
0
    def __call__(self):
        '''Calls score template.

        Returns LilyPond file.
        '''

        # make bell voice and staff
        bell_voice = scoretools.Voice(name='Bell Voice')
        bell_staff = scoretools.Staff([bell_voice], name='Bell Staff')
        clef = indicatortools.Clef('treble')
        attach(clef, bell_staff)
        bells = instrumenttools.Instrument(
            instrument_name='Campana in La',
            short_instrument_name='Camp.',
            pitch_range='[C4, C6]',
        )
        attach(bells, bell_staff)
        tempo = indicatortools.Tempo((1, 4), (112, 120))
        attach(tempo, bell_staff)
        time_signature = indicatortools.TimeSignature((6, 4))
        attach(time_signature, bell_staff)

        # make first violin voice and staff
        first_violin_voice = scoretools.Voice(name='First Violin Voice')
        first_violin_staff = scoretools.Staff(
            [first_violin_voice],
            name='First Violin Staff',
        )
        clef = indicatortools.Clef('treble')
        attach(clef, first_violin_staff)
        violin = instrumenttools.Violin(
            instrument_name_markup=markuptools.Markup('Violin I'),
            short_instrument_name_markup=markuptools.Markup('Vl. I'),
        )
        attach(violin, first_violin_staff)

        # make second violin voice and staff
        second_violin_voice = scoretools.Voice(name='Second Violin Voice')
        second_violin_staff = scoretools.Staff(
            [second_violin_voice],
            name='Second Violin Staff',
        )
        clef = indicatortools.Clef('treble')
        attach(clef, second_violin_staff)
        violin = instrumenttools.Violin(
            instrument_name_markup=markuptools.Markup('Violin II'),
            short_instrument_name_markup=markuptools.Markup('Vl. II'),
        )
        attach(violin, second_violin_staff)

        # make viola voice and staff
        viola_voice = scoretools.Voice(name='Viola Voice')
        viola_staff = scoretools.Staff([viola_voice], name='Viola Staff')
        clef = indicatortools.Clef('alto')
        attach(clef, viola_staff)
        viola = instrumenttools.Viola()
        attach(viola, viola_staff)

        # make cello voice and staff
        cello_voice = scoretools.Voice(name='Cello Voice')
        cello_staff = scoretools.Staff([cello_voice], name='Cello Staff')
        clef = indicatortools.Clef('bass')
        attach(clef, cello_staff)
        cello = instrumenttools.Cello()
        attach(cello, cello_staff)

        # make bass voice and staff
        bass_voice = scoretools.Voice(name='Bass Voice')
        bass_staff = scoretools.Staff([bass_voice], name='Bass Staff')
        clef = indicatortools.Clef('bass')
        attach(clef, bass_staff)
        contrabass = instrumenttools.Contrabass(
            short_instrument_name_markup=markuptools.Markup('Cb.'), )
        attach(contrabass, bass_staff)

        # make strings staff group
        strings_staff_group = scoretools.StaffGroup(
            [
                first_violin_staff,
                second_violin_staff,
                viola_staff,
                cello_staff,
                bass_staff,
            ],
            name='Strings Staff Group',
        )

        # make score
        score = scoretools.Score([
            bell_staff,
            strings_staff_group,
        ],
                                 name='Pärt Cantus Score')

        # return Pärt Cantus score
        return score
    def __call__(self):

        pitch_pipes = instrumenttools.Percussion(
            instrument_name='pitch pipes',
            instrument_name_markup=markuptools.Markup.right_column(
                ['Pitch', 'Pipes'],
                direction=None,
            ),
            short_instrument_name='pp.',
        )

        time_signature_context = scoretools.Context(
            context_name='TimeSignatureContext',
            name='Time Signature Context',
        )
        self._attach_tag('time', time_signature_context)

        flute_staff = self._make_staff(
            'Flute',
            'treble',
            instrument=instrumenttools.Flute(),
            tag='flute',
        )

        oboe_staff = self._make_staff(
            'Oboe',
            'treble',
            instrument=instrumenttools.Oboe(),
            tag='oboe',
        )

        clarinet_staff = self._make_staff(
            'Clarinet',
            'treble',
            instrument=instrumenttools.BassClarinet(
                instrument_name_markup=markuptools.Markup.right_column(
                    ['Bass', 'Clarinet'],
                    direction=None,
                ), ),
            tag='clarinet',
        )

        saxophone_staff = self._make_staff(
            'Saxophone',
            'treble',
            instrument=instrumenttools.BaritoneSaxophone(
                instrument_name_markup=markuptools.Markup.right_column(
                    ['Baritone', 'Saxophone'],
                    direction=None,
                ), ),
            tag='saxophone',
        )

        wind_section_staff_group = scoretools.StaffGroup(
            [
                flute_staff,
                oboe_staff,
                clarinet_staff,
                saxophone_staff,
            ],
            context_name='WindSectionStaffGroup',
            name='Wind Section Staff Group',
        )

        guitar_staff = self._make_staff(
            'Guitar',
            'treble_8',
            instrument=instrumenttools.Guitar(),
        )
        guitar_aux_staff = self._make_staff(
            'Guitar Pitch Pipe',
            'percussion',
            abbreviation='guitar_pp',
            context_name='Pitch Pipes',
            instrument=pitch_pipes,
        )
        guitar_staff_group = scoretools.StaffGroup(
            [guitar_aux_staff, guitar_staff],
            name='Guitar Staff Group',
            context_name='GuitarStaffGroup',
        )
        self._attach_tag('guitar', guitar_staff_group)

        piano_aux_staff = self._make_staff(
            'Piano Pitch Pipe',
            'percussion',
            abbreviation='piano_pp',
            context_name='Pitch Pipes',
            instrument=pitch_pipes,
        )
        piano_rh_staff = self._make_staff(
            'Piano Upper',
            'treble',
            abbreviation='piano_rh',
        )
        piano_lh_staff = self._make_staff(
            'Piano Lower',
            'bass',
            abbreviation='piano_lh',
        )
        piano_pedals = self._make_voice(
            'Piano Pedals',
            context_name='Dynamics',
        )
        piano_staff = scoretools.StaffGroup(
            [piano_rh_staff, piano_lh_staff, piano_pedals],
            context_name='PianoStaff',
            name='Piano Staff',
        )
        attach(instrumenttools.Piano(), piano_staff)
        piano_staff_group = scoretools.StaffGroup(
            [piano_aux_staff, piano_staff],
            context_name='PianoStaffGroup',
            name='Piano Staff Group',
        )
        self._attach_tag('piano', piano_staff_group)

        percussion_staff = self._make_staff(
            'Percussion',
            'percussion',
            instrument=instrumenttools.Percussion(),
        )
        percussion_aux_staff = self._make_staff(
            'Percussion Pitch Pipe',
            'percussion',
            abbreviation='percussion_pp',
            context_name='Pitch Pipes',
            instrument=pitch_pipes,
        )
        percussion_staff_group = scoretools.StaffGroup(
            [percussion_aux_staff, percussion_staff],
            name='Percussion Staff Group',
            context_name='PercussionStaffGroup',
        )
        self._attach_tag('percussion', percussion_staff_group)

        percussion_section_staff_group = scoretools.StaffGroup(
            [
                guitar_staff_group,
                piano_staff_group,
                percussion_staff_group,
            ],
            context_name='PercussionSectionStaffGroup',
            name='Percussion Section Staff Group',
        )

        violin_staff = self._make_staff(
            'Violin',
            'treble',
            instrument=instrumenttools.Violin(),
            tag='violin',
        )

        viola_staff = self._make_staff(
            'Viola',
            'alto',
            instrument=instrumenttools.Viola(),
            tag='viola',
        )

        cello_staff = self._make_staff(
            'Cello',
            'bass',
            instrument=instrumenttools.Cello(),
            tag='cello',
        )

        contrabass_aux_staff = self._make_staff(
            'Contrabass Pitch Pipe',
            'percussion',
            abbreviation='bass_pp',
            context_name='Pitch Pipes',
            instrument=pitch_pipes,
        )
        contrabass_staff = self._make_staff(
            'Contrabass',
            'bass_8',
            abbreviation='bass',
            instrument=instrumenttools.Contrabass(pitch_range='[E1, G4]', ),
        )
        contrabass_staff_group = scoretools.StaffGroup(
            [contrabass_aux_staff, contrabass_staff],
            name='Contrabass Staff Group',
            context_name='ContrabassStaffGroup',
        )
        self._attach_tag('contrabass', contrabass_staff_group)

        string_section_staff_group = scoretools.StaffGroup(
            [
                violin_staff,
                viola_staff,
                cello_staff,
                contrabass_staff_group,
            ],
            context_name='StringSectionStaffGroup',
            name='String Section Staff Group',
        )

        score = scoretools.Score(
            [
                time_signature_context,
                wind_section_staff_group,
                percussion_section_staff_group,
                string_section_staff_group,
            ],
            name='Ersilia Score',
        )

        return score