Ejemplo n.º 1
0
def configure_score(score):
    """
    Configures score.
    """
    # configure bell staff
    bell_staff = score["Bell Staff"]
    leaf = abjad.inspect(bell_staff).leaf(0)
    clef = abjad.Clef("treble")
    abjad.attach(clef, leaf)
    bells = abjad.Instrument(name="Campana in La",
                             short_name="Camp.",
                             pitch_range="[C4, C6]")
    abjad.attach(bells, leaf)
    mark = abjad.MetronomeMark((1, 4), (112, 120))
    abjad.attach(mark, leaf)
    # time_signature = abjad.TimeSignature((6, 4))
    # abjad.attach(time_signature, leaf)
    # configure first violin staff
    first_violin_staff = score["First Violin Staff"]
    leaf = abjad.inspect(first_violin_staff).leaf(0)
    clef = abjad.Clef("treble")
    abjad.attach(clef, leaf)
    violin = abjad.Violin(markup=abjad.Markup("Violin I"),
                          short_markup=abjad.Markup("Vl. I"))
    abjad.attach(violin, leaf)
    # configure second violin staff
    second_violin_staff = score["Second Violin Staff"]
    leaf = abjad.inspect(second_violin_staff).leaf(0)
    clef = abjad.Clef("treble")
    abjad.attach(clef, leaf)
    violin = abjad.Violin(markup=abjad.Markup("Violin II"),
                          short_markup=abjad.Markup("Vl. II"))
    abjad.attach(violin, leaf)
    # configure viola staff
    leaf = abjad.inspect(score["Viola Staff"]).leaf(0)
    clef = abjad.Clef("alto")
    abjad.attach(clef, leaf)
    viola = abjad.Viola()
    abjad.attach(viola, leaf)
    # configure cello staff
    leaf = abjad.inspect(score["Cello Staff"]).leaf(0)
    clef = abjad.Clef("bass")
    abjad.attach(clef, leaf)
    cello = abjad.Cello()
    abjad.attach(cello, leaf)
    # configure bass staff
    leaf = abjad.inspect(score["Bass Staff"]).leaf(0)
    clef = abjad.Clef("bass")
    abjad.attach(clef, leaf)
    contrabass = abjad.Contrabass(short_markup=abjad.Markup("Cb."))
    abjad.attach(contrabass, leaf)
    # configure score
    vector = abjad.SpacingVector(0, 0, 8, 0)
    abjad.override(score).vertical_axis_group.staff_staff_spacing = vector
    abjad.override(score).staff_grouper.staff_staff_spacing = vector
    abjad.override(score).staff_symbol.thickness = 0.5
    scheme = abjad.Scheme("format-mark-box-numbers")
    abjad.setting(score).mark_formatter = scheme
Ejemplo n.º 2
0
    def __call__(self):
        r'''Calls string orchestra template.

        Returns score.
        '''
        import abjad

        ### TAGS ###

        tag_names = []

        ### SCORE ###

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

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

        ### VIOLINS ###

        if self.violin_count:
            clef_name = 'treble'
            if self.use_percussion_clefs:
                clef_name = 'percussion'
            instrument = abjad.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 = abjad.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 = abjad.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 = abjad.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 ###

        global_context = abjad.Context(
            name='GlobalContext',
            lilypond_type='GlobalContext',
        )
        instrument_tags = ' '.join(tag_names)
        tag_string = r"\tag #'({})".format(instrument_tags)
        tag_command = abjad.LilyPondLiteral(tag_string, 'before')
        abjad.attach(tag_command, global_context)
        score.insert(0, global_context)
        return score
Ejemplo n.º 3
0
import inspect
import typing

import abjad
import baca
from abjadext import rmakers

instruments = dict([
    ("BassClarinet", abjad.BassClarinet()),
    ("Bassoon", abjad.Bassoon()),
    ("Cello", abjad.Cello()),
    ("Clarinet", abjad.ClarinetInBFlat()),
    ("Contrabass", abjad.Contrabass(pitch_range="[E1, D6]")),
    ("EnglishHorn", abjad.EnglishHorn()),
    ("Flute", abjad.Flute()),
    ("Harp", abjad.Harp()),
    ("Horn", abjad.FrenchHorn()),
    ("Oboe", abjad.Oboe()),
    ("Percussion", abjad.Percussion()),
    ("Piano", abjad.Piano()),
    ("Trombone", abjad.TenorTrombone()),
    ("Trumpet", abjad.Trumpet()),
    ("Tuba", abjad.Tuba()),
    ("Vibraphone", abjad.Vibraphone()),
    ("Viola", abjad.Viola()),
    ("Violin", abjad.Violin()),
])


def instrument(key):
    return baca.instrument(instruments[key])
Ejemplo n.º 4
0
instrument_seven = abjad.Cello()
instrument_seven_range = instrument_seven.pitch_range
instrument_seven_range_lowest = abjad.NumberedPitch(
    instrument_seven_range.start_pitch)
instrument_seven_range_highest = abjad.NumberedPitch(
    instrument_seven_range.stop_pitch)

instrument_eight = abjad.Cello()
instrument_eight_range = instrument_eight.pitch_range
instrument_eight_range_lowest = abjad.NumberedPitch(
    instrument_eight_range.start_pitch)
instrument_eight_range_highest = abjad.NumberedPitch(
    instrument_eight_range.stop_pitch)

instrument_nine = abjad.Contrabass()
instrument_nine_range = instrument_nine.pitch_range
instrument_nine_range_lowest = abjad.NumberedPitch(
    instrument_nine_range.start_pitch)
instrument_nine_range_highest = abjad.NumberedPitch(
    instrument_nine_range.stop_pitch)

instruments = [
    instrument_one,
    instrument_two,
    instrument_three,
    instrument_four,
    instrument_five,
    instrument_six,
    instrument_seven,
    instrument_eight,
Ejemplo n.º 5
0
 class CcoBass(calliope.Staff):
     instrument=abjad.Contrabass(
         name="Bass", short_name="cb.")
     clef="bass"
     midi_instrument = "cello"
Ejemplo n.º 6
0
Archivo: part.py Proyecto: gsy/gmajor
def configure_score(score):
    """
    Configures score.
    """
    # configure bell staff
    bell_staff = score['Bell Staff']
    leaf = abjad.inspect(bell_staff).leaf(0)
    clef = abjad.Clef('treble')
    abjad.attach(clef, leaf)
    bells = abjad.Instrument(
        name='Campana in La',
        short_name='Camp.',
        pitch_range='[C4, C6]',
        )
    abjad.attach(bells, leaf)
    mark = abjad.MetronomeMark((1, 4), (112, 120))
    abjad.attach(mark, leaf)
    time_signature = abjad.TimeSignature((6, 4))
    abjad.attach(time_signature, leaf)
    # configure first violin staff
    first_violin_staff = score['First Violin Staff']
    leaf = abjad.inspect(first_violin_staff).leaf(0)
    clef = abjad.Clef('treble')
    abjad.attach(clef, leaf)
    violin = abjad.Violin(
        markup=abjad.Markup('Violin I'),
        short_markup=abjad.Markup('Vl. I'),
        )
    abjad.attach(violin, leaf)
    # configure second violin staff
    second_violin_staff = score['Second Violin Staff']
    leaf = abjad.inspect(second_violin_staff).leaf(0)
    clef = abjad.Clef('treble')
    abjad.attach(clef, leaf)
    violin = abjad.Violin(
        markup=abjad.Markup('Violin II'),
        short_markup=abjad.Markup('Vl. II'),
        )
    abjad.attach(violin, leaf)
    # configure viola staff
    leaf = abjad.inspect(score['Viola Staff']).leaf(0)
    clef = abjad.Clef('alto')
    abjad.attach(clef, leaf)
    viola = abjad.Viola()
    abjad.attach(viola, leaf)
    # configure cello staff
    leaf = abjad.inspect(score['Cello Staff']).leaf(0)
    clef = abjad.Clef('bass')
    abjad.attach(clef, leaf)
    cello = abjad.Cello()
    abjad.attach(cello, leaf)
    # configure bass staff
    leaf = abjad.inspect(score['Bass Staff']).leaf(0)
    clef = abjad.Clef('bass')
    abjad.attach(clef, leaf)
    contrabass = abjad.Contrabass(
        short_markup=abjad.Markup('Cb.'),
        )
    abjad.attach(contrabass, leaf)
    # configure score
    vector = abjad.SpacingVector(0, 0, 8, 0)
    abjad.override(score).vertical_axis_group.staff_staff_spacing = vector
    abjad.override(score).staff_grouper.staff_staff_spacing = vector
    abjad.override(score).staff_symbol.thickness = 0.5
    scheme = abjad.Scheme('format-mark-box-numbers')
    abjad.setting(score).mark_formatter = scheme