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
def test_scoretools_Inspection_get_indicator_14():

    staff = abjad.Staff("c'8 d'8 e'8 f'8")
    violin = abjad.Violin()
    abjad.attach(violin, staff[0])

    indicator = abjad.inspect(staff[0]).get_indicator(abjad.Instrument)

    assert indicator is violin
Example #3
0
def make_note_sheet(music):
    violin = abjad.Violin()
    notes=[]
    for row in music:
        if row[0]=='r':
            if row[-1]:
                note=abjad.Rest(row[-2])
            else:
                note=abjad.Rest(abjad.Duration(1,int(lilypod_dur[row[-2]])))
        else:
            x=notes_ann[row[0]].lower()
            if x[-1]=='#' or x[-1]=='b':
                x=x[0]
                x=x+'s'
            note_=x
            oct_=Helmholtz_octave[row[1]]
            due_=lilypod_dur[row[-2]]
            note=abjad.Note(note_+oct_+due_)
        notes.append(note)  
    abjad.attach(violin, notes[0])
    container = abjad.Container(notes)
    abjad.show(container)        
    return
Example #4
0
import abjad
import mccartney

instruments = abjad.OrderedDict([
    (
        "Violin",
        abjad.Violin(
            markup=mccartney.markups.instrument("Violin"),
            short_markup=mccartney.markups.short_instrument("vln"),
        ),
    ),
    (
        "MonoSynth",
        abjad.ClarinetInBFlat(
            markup=mccartney.markups.instrument("MonoSynth"),
            short_markup=mccartney.markups.short_instrument("msy"),
        ),
    ),
    (
        "PolySynth",
        abjad.Piano(
            markup=mccartney.markups.instrument("PolySynth"),
            short_markup=mccartney.markups.short_instrument("psy"),
        ),
    ),
])

if __name__ == '__main__':
    for key, item in instruments.items():
        print(key, item)
Example #5
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 #6
0
import abjad
import evans

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.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)
Example #7
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 #8
0
 class OoaViolin1(calliope.Staff):
     instrument=abjad.Violin(
         name="Violin 1", short_name="vln.1")
     midi_instrument = "violin"
Example #9
0
 class CcoViolinIi4(calliope.Staff):
     instrument = abjad.Violin(name="Violin II 4",
                               short_name="vln.II.4")
Example #10
0
    d = {}

    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,
Example #11
0
def instruments():
    return {
        "Piano": abjad.Piano(),
        "Violin": abjad.Violin(),
    }
Example #12
0
 class Violin2(calliope.Staff):
     instrument = abjad.Violin(name="Violin 2", short_name="vln.2")
Example #13
0
# Note: the markup for "instrumentName" in lilypond will be the lilypond_name variable with a espace between the words.
bass_clarinet = muda.score.Instrument(
    abjad_instrument=abjad.BassClarinet(),
    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()
Example #14
0
 class OoaViolins(calliope.Staff):
     instrument = abjad.Violin(name="Violin 1,2",
                               short_name="vln.1,2")
Example #15
0
import abjad

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 = [
Example #16
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 #17
0
    ("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,
        alert=alert,
Example #18
0
 class CcoViolinIi(calliope.Staff):
     instrument=abjad.Violin(
         name="Violin 2", short_name="vln.II")
     midi_instrument = "string ensemble 1"
Example #19
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 #20
0
 class CcoViolinI3(calliope.Staff):
     instrument = abjad.Violin(name="Violin I 3",
                               short_name="vln.I.3")