Example #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
Example #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
Example #3
0
    for instr in scale_per_instrument:
        for p in scale_per_instrument[instr]:
            d.update({p.normalize(): instr})

    return d


PITCH2SCALE_DEGREE = _make_pitch2scale_degree_dict(INTONATIONS_PER_SCALE_DEGREE)
PITCH2INSTRUMENT = _make_pitch2instrument_dict(SCALE_PER_INSTRUMENT)


INSTRUMENT_NAME2OBJECT = {
    "cello": abjad.Cello(),
    "violin": abjad.Violin(),
    "viola": abjad.Viola(),
    "keyboard": abjad.Piano(name="keyboard", short_name="kbd."),
}


STANDARD_TEMPI = (
    35,
    36,
    37,
    38,
    39,
    40,
    42,
    44,
    46,
    48,
Example #4
0
    ("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])


def margin_markup(key,
                  alert=None,
                  context="Staff",
                  selector=baca.selectors.leaf(0)):
    margin_markup = margin_markups[key]
    command = baca.margin_markup(
        margin_markup,
Example #5
0
instrument_one = abjad.Violin()
instrument_one_range = instrument_one.pitch_range
instrument_one_range_lowest = abjad.NumberedPitch(
    instrument_one_range.start_pitch)
instrument_one_range_highest = abjad.NumberedPitch(
    instrument_one_range.stop_pitch)

instrument_two = abjad.Violin()
instrument_two_range = instrument_two.pitch_range
instrument_two_range_lowest = abjad.NumberedPitch(
    instrument_two_range.start_pitch)
instrument_two_range_highest = abjad.NumberedPitch(
    instrument_two_range.stop_pitch)

instrument_three = abjad.Viola()
instrument_three_range = instrument_three.pitch_range
instrument_three_range_lowest = abjad.NumberedPitch(
    instrument_three_range.start_pitch)
instrument_three_range_highest = abjad.NumberedPitch(
    instrument_three_range.stop_pitch)

instrument_four = abjad.Cello()
instrument_four_range = instrument_four.pitch_range
instrument_four_range_lowest = abjad.NumberedPitch(
    instrument_four_range.start_pitch)
instrument_four_range_highest = abjad.NumberedPitch(
    instrument_four_range.stop_pitch)

instruments = [
    instrument_one, instrument_two, instrument_three, instrument_four
Example #6
0
    def __call__(self):
        """
        Calls string quartet score template.

        Returns score.
        """
        import abjad

        # make first violin voice and staff
        first_violin_voice = abjad.Voice(
            [],
            name='First Violin Voice',
        )
        first_violin_staff = abjad.Staff(
            [first_violin_voice],
            name='First Violin Staff',
        )
        clef = abjad.Clef('treble')
        abjad.annotate(first_violin_staff, 'default_clef', clef)
        violin = abjad.Violin()
        abjad.annotate(first_violin_staff, 'default_instrument', violin)
        tag = abjad.LilyPondLiteral(r"\tag #'first-violin", 'before')
        abjad.attach(tag, first_violin_staff)

        # make second violin voice and staff
        second_violin_voice = abjad.Voice(
            [],
            name='Second Violin Voice',
        )
        second_violin_staff = abjad.Staff(
            [second_violin_voice],
            name='Second Violin Staff',
        )
        clef = abjad.Clef('treble')
        abjad.annotate(second_violin_staff, 'default_clef', clef)
        violin = abjad.Violin()
        abjad.annotate(second_violin_staff, 'default_instrument', violin)
        tag = abjad.LilyPondLiteral(r"\tag #'second-violin", 'before')
        abjad.attach(tag, second_violin_staff)

        # make viola voice and staff
        viola_voice = abjad.Voice(
            [],
            name='Viola Voice',
        )
        viola_staff = abjad.Staff(
            [viola_voice],
            name='Viola Staff',
        )
        clef = abjad.Clef('alto')
        abjad.annotate(viola_staff, 'default_clef', clef)
        viola = abjad.Viola()
        abjad.annotate(viola_staff, 'default_instrument', viola)
        tag = abjad.LilyPondLiteral(r"\tag #'viola", 'before')
        abjad.attach(tag, viola_staff)

        # make cello voice and staff
        cello_voice = abjad.Voice(
            [],
            name='Cello Voice',
        )
        cello_staff = abjad.Staff(
            [cello_voice],
            name='Cello Staff',
        )
        clef = abjad.Clef('bass')
        abjad.annotate(cello_staff, 'default_clef', clef)
        cello = abjad.Cello()
        abjad.annotate(cello_staff, 'default_instrument', cello)
        tag = abjad.LilyPondLiteral(r"\tag #'cello", 'before')
        abjad.attach(tag, cello_staff)

        # make string quartet staff group
        string_quartet_staff_group = abjad.StaffGroup(
            [
                first_violin_staff,
                second_violin_staff,
                viola_staff,
                cello_staff,
            ],
            name='String Quartet Staff Group',
        )

        # make string quartet score
        string_quartet_score = abjad.Score(
            [string_quartet_staff_group],
            name='String Quartet Score',
        )

        # return string quartet score
        return string_quartet_score
Example #7
0
instrument_three = abjad.Violin()
instrument_three_range = instrument_three.pitch_range
instrument_three_range_lowest = abjad.NumberedPitch(
    instrument_three_range.start_pitch)
instrument_three_range_highest = abjad.NumberedPitch(
    instrument_three_range.stop_pitch)

instrument_four = abjad.Violin()
instrument_four_range = instrument_four.pitch_range
instrument_four_range_lowest = abjad.NumberedPitch(
    instrument_four_range.start_pitch)
instrument_four_range_highest = abjad.NumberedPitch(
    instrument_four_range.stop_pitch)

instrument_five = abjad.Viola()
instrument_five_range = instrument_five.pitch_range
instrument_five_range_lowest = abjad.NumberedPitch(
    instrument_five_range.start_pitch)
instrument_five_range_highest = abjad.NumberedPitch(
    instrument_five_range.stop_pitch)

instrument_six = abjad.Viola()
instrument_six_range = instrument_six.pitch_range
instrument_six_range_lowest = abjad.NumberedPitch(
    instrument_six_range.start_pitch)
instrument_six_range_highest = abjad.NumberedPitch(
    instrument_six_range.stop_pitch)

instrument_seven = abjad.Cello()
instrument_seven_range = instrument_seven.pitch_range
Example #8
0
    def __call__(self):
        """
        Calls string quartet score template.

        Returns score.
        """
        import abjad

        site = "abjad.StringQuartetScoreTemplate.__call__()"
        tag = Tag(site)

        # make first violin voice and staff
        first_violin_voice = abjad.Voice(
            [], name="First_Violin_Voice", tag=tag
        )
        first_violin_staff = abjad.Staff(
            [first_violin_voice], name="First_Violin_Staff", tag=tag
        )
        clef = abjad.Clef("treble")
        abjad.annotate(first_violin_staff, "default_clef", clef)
        violin = abjad.Violin()
        abjad.annotate(first_violin_staff, "default_instrument", violin)
        literal = abjad.LilyPondLiteral(r"\tag #'first-violin", "before")
        abjad.attach(literal, first_violin_staff)

        # make second violin voice and staff
        second_violin_voice = abjad.Voice(
            [], name="Second_Violin_Voice", tag=tag
        )
        second_violin_staff = abjad.Staff(
            [second_violin_voice], name="Second_Violin_Staff", tag=tag
        )
        clef = abjad.Clef("treble")
        abjad.annotate(second_violin_staff, "default_clef", clef)
        violin = abjad.Violin()
        abjad.annotate(second_violin_staff, "default_instrument", violin)
        literal = abjad.LilyPondLiteral(r"\tag #'second-violin", "before")
        abjad.attach(literal, second_violin_staff)

        # make viola voice and staff
        viola_voice = abjad.Voice([], name="Viola_Voice", tag=tag)
        viola_staff = abjad.Staff(
            [viola_voice], name="Viola_Staff", tag=tag
        )
        clef = abjad.Clef("alto")
        abjad.annotate(viola_staff, "default_clef", clef)
        viola = abjad.Viola()
        abjad.annotate(viola_staff, "default_instrument", viola)
        literal = abjad.LilyPondLiteral(r"\tag #'viola", "before")
        abjad.attach(literal, viola_staff)

        # make cello voice and staff
        cello_voice = abjad.Voice([], name="Cello_Voice", tag=tag)
        cello_staff = abjad.Staff(
            [cello_voice], name="Cello_Staff", tag=tag
        )
        clef = abjad.Clef("bass")
        abjad.annotate(cello_staff, "default_clef", clef)
        cello = abjad.Cello()
        abjad.annotate(cello_staff, "default_instrument", cello)
        literal = abjad.LilyPondLiteral(r"\tag #'cello", "before")
        abjad.attach(literal, cello_staff)

        # make string quartet staff group
        string_quartet_staff_group = abjad.StaffGroup(
            [
                first_violin_staff,
                second_violin_staff,
                viola_staff,
                cello_staff,
            ],
            name="String_Quartet_Staff_Group",
            tag=tag,
        )

        # make string quartet score
        string_quartet_score = abjad.Score(
            [string_quartet_staff_group],
            name="String_Quartet_Score",
            tag=tag,
        )

        # return string quartet score
        return string_quartet_score
Example #9
0
 class CcoViola(calliope.Staff):
     instrument=abjad.Viola(
         name="Viola", short_name="vla.")
     midi_instrument = "string ensemble 1"
     clef = "alto"
Example #10
0
File: part.py Project: 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
Example #11
0
 class Viola(calliope.Staff):
     instrument = abjad.Viola(name="Viola", short_name="vla.")
Example #12
0
    lilypond_name="BassClarinet",
    nstaffs=1,
    nvoices=[1],
)
piano = muda.score.Instrument(
    abjad_instrument=abjad.Piano(),
    lilypond_name="Piano",
    nstaffs=2,
    nvoices=[2, 2],
    piano=True,
)
violin = muda.score.Instrument(abjad_instrument=abjad.Violin(),
                               lilypond_name="Violin",
                               nstaffs=1,
                               nvoices=[1])
viola = muda.score.Instrument(abjad_instrument=abjad.Viola(),
                              lilypond_name="Viola",
                              nstaffs=1,
                              nvoices=[1])
cello = muda.score.Instrument(abjad_instrument=abjad.Cello(),
                              lilypond_name="Cello",
                              nstaffs=1,
                              nvoices=[1])
instruments = [alto_flute, bass_clarinet, piano, violin, viola, cello]

# Create score
score = muda.score.MakeScore()

# Add instruments to score
muda.score.AddInstrument(instruments, score)
Example #13
0
 class CcoViola4(calliope.Staff):
     instrument = abjad.Viola(name="Viola 4",
                              short_name="vla.4")
     clef = "alto"