def test_reposition_clefs_08():
    staff = abjad.Staff(r"c'1 | d'1")
    abjad.attach(abjad.Clef('treble'), staff[1])
    assert abjad.lilypond(staff) == abjad.String.normalize(r"""
        \new Staff
        {
            c'1
            \clef "treble"
            d'1
        }
        """)
    auxjad.mutate.reposition_clefs(staff[:])
    assert abjad.lilypond(staff) == abjad.String.normalize(r"""
        \new Staff
        {
            c'1
            d'1
        }
        """)
Esempio n. 2
0
def test_LilyPondParser__indicators__Clef_01():

    target = abjad.Staff([abjad.Note(0, 1)])
    clef = abjad.Clef('bass')
    abjad.attach(clef, target[0])

    assert format(target) == abjad.String.normalize(r"""
        \new Staff
        {
            \clef "bass"
            c'1
        }
        """)

    parser = abjad.parser.LilyPondParser()
    result = parser(format(target))
    assert format(target) == format(result) and target is not result
    clefs = abjad.inspect(result[0]).indicators(abjad.Clef)
    assert len(clefs) == 1
Esempio n. 3
0
def post_process_voice_one(voice_one, score):
    print("post processing voice one")

    voice_one[-2] = abjad.Skip((3, 4))
    voice_one[-1] = abjad.Skip((3, 4))

    # change staff
    voice_one = score['RH_Voice_One']
    rh_staff = score['Piano_Staff'][0]
    lh_staff = score['Piano_Staff'][1]

    staff_change1 = abjad.StaffChange(lh_staff)
    staff_change2 = abjad.StaffChange(rh_staff)
    abjad.attach(staff_change1, voice_one[6][0])

    # change clef
    clef1 = abjad.Clef("bass")
    abjad.attach(clef1, voice_one[8])

    # tempos
    lento = abjad.MetronomeMark(None, None, "Lento")
    quasi_statico = abjad.MetronomeMark(None, None, "Quasi Statico")
    # metronome mark I
    abjad.attach(lento, voice_one[0])
    # metronome mark II
    abjad.attach(quasi_statico, voice_one[8])
    # metronome mark III
    abjad.attach(lento, voice_one[15][0])

    # metronome mark IV
    abjad.attach(abjad.MetronomeMark(None, None, "subito Quasi Statico"),
                 voice_one[18])
    # metronome mark V
    abjad.attach(lento, voice_one[22])
    # metronome mark VI
    abjad.attach(abjad.MetronomeMark(None, None, "più mosso"), voice_one[25])

    # rehearsal mark
    markI = abjad.RehearsalMark(number=3)
    abjad.attach(markI, voice_one[0])
    scheme = abjad.Scheme("format-mark-box-alphabet")
    abjad.setting(score).markFormatter = scheme
    return voice_one
Esempio n. 4
0
def make_vla_vln_score(chords, midi=False):
    vla_chords = []
    vln_chords = []

    for chord in chords:
        vla_chord = chord[:4]
        vln_chord = chord[1:]
        vla_chords.append(vla_chord)
        vln_chords.append(vln_chord)

    vla_staff = make_one_part(vla_chords, parenthesis=3)
    clef = abjad.Clef(name='alto')
    abjad.attach(clef, vla_staff[0])
    viola = abjad.instrumenttools.Viola()
    abjad.attach(viola, vla_staff)
    #vla_staff.name = 'Viola'
    vln_staff = make_one_part(vln_chords, parenthesis=0)
    violin = abjad.instrumenttools.Violin()
    abjad.attach(violin, vln_staff)
    #vln_staff.name = 'Violin'
    score = abjad.Score([vln_staff, vla_staff])
    score.add_final_bar_line()

    lilypond_file = abjad.LilyPondFile.new(score,
                                           default_paper_size=('letter',
                                                               'landscape'),
                                           global_staff_size=20)

    #postscript = abjad.Postscript()

    lilypond_file.header_block.title = abjad.Markup("tuning no. 4:")

    lilypond_file.header_block.title.setfont("Arial")
    lilypond_file.header_block.subtitle = abjad.Markup('Pythagorean chains')
    lilypond_file.header_block.composer = abjad.Markup('John Eagle')
    lilypond_file.header_block.tagline = " "
    lilypond_file.paper_block.top_margin = 15
    lilypond_file.paper_block.left_margin = 20

    abjad.show(lilypond_file)
    if midi:
        abjad.play(score)
Esempio n. 5
0
 def __init__(
     self,
     counts,
     denominator,
     mask_indices,
     mask_period,
     pitches,
     extra_counts_per_division=[0],
     beams=False,
     clef='treble',
     #tag='None',
 ):
     self.counts = counts
     self.denominator = denominator
     self.extra_counts_per_division = extra_counts_per_division
     self.mask_indices = mask_indices
     self.mask_period = mask_period
     self.pitches = pitches
     self.beams = beams
     self.clef = abjad.Clef(clef)
def test_mutate__fuse_leaves_by_immediate_parent_08():
    """
    Fuse leaves in logical tie with same immediate parent.
    """

    staff = abjad.Staff(r"c'16 ~ c'16 ~ c'16 ~ c'16 ~ c'16 r16 r16 r16 r4 r4")
    indicators = (
        abjad.BeforeGraceContainer("b'16"),
        abjad.Clef("alto"),
        abjad.TimeSignature((3, 4)),
        abjad.Articulation("staccato"),
        abjad.Articulation("accent"),
    )
    for indicator in indicators:
        abjad.attach(indicator, staff[0])
    logical_tie = abjad.get.logical_tie(staff[0])
    result = abjad.mutate._fuse_leaves_by_immediate_parent(logical_tie)

    assert abjad.lilypond(staff) == abjad.String.normalize(r"""
        \new Staff
        {
            \grace {
                b'16
            }
            \time 3/4
            \clef "alto"
            c'4
            - \staccato
            - \accent
            ~
            c'16
            r16
            r16
            r16
            r4
            r4
        }
        """), print(abjad.lilypond(staff))

    assert abjad.wf.wellformed(staff)
    assert len(result) == 1
Esempio n. 7
0
def test_Inspection_indicators_03():

    staff = abjad.Staff("c'8 d'8 e'8 f'8")
    clef = abjad.Clef("treble")
    abjad.attach(clef, staff[0])
    dynamic = abjad.Dynamic("p")
    abjad.attach(dynamic, staff[0])

    assert format(staff) == abjad.String.normalize(r"""
        \new Staff
        {
            \clef "treble"
            c'8
            \p
            d'8
            e'8
            f'8
        }
        """), format(staff)

    indicators = abjad.inspect(staff[0]).indicators()
    assert len(indicators) == 2
def test_scoretools_Inspection_get_indicators_03():

    staff = abjad.Staff("c'8 d'8 e'8 f'8")
    clef = abjad.Clef('treble')
    abjad.attach(clef, staff[0])
    dynamic = abjad.Dynamic('p')
    abjad.attach(dynamic, staff[0])

    assert format(staff) == abjad.String.normalize(r'''
        \new Staff
        {
            \clef "treble"
            c'8
            \p
            d'8
            e'8
            f'8
        }
        '''), format(staff)

    indicators = abjad.inspect(staff[0]).get_indicators()
    assert len(indicators) == 2
Esempio n. 9
0
def test_Hocketer_18():
    random.seed(97813)
    container = abjad.Container(r"c4 d8 e'8 f'4 g'8 a8")
    hocketer = auxjad.Hocketer(container,
                               n_voices=2,
                               pitch_ranges=[abjad.PitchRange("[C4, B5]"),
                                             abjad.PitchRange("[C3, B3]"),
                                             ])
    hocketer()
    score = abjad.Score()
    for selection in hocketer[:]:
        staff = abjad.Staff(selection)
        score.append(staff)
    abjad.attach(abjad.Clef('bass'), abjad.select(score[1]).leaf(0))
    assert abjad.lilypond(score) == abjad.String.normalize(
        r"""
        \new Score
        <<
            \new Staff
            {
                r4.
                e'8
                f'4
                g'8
                r8
            }
            \new Staff
            {
                \clef "bass"
                c4
                d8
                r8
                r4.
                a8
            }
        >>
        """
    )
Esempio n. 10
0
def show_score(voiced_chords):
    def add2staff(voice1, voice2, staff):
        voice1 = abjad.Voice(voice1)
        command = abjad.indicatortools.LilyPondCommand('voiceOne')
        abjad.attach(command, voice1)
        voice2 = abjad.Voice(voice2)
        command = abjad.indicatortools.LilyPondCommand('voiceTwo')
        abjad.attach(command, voice2)
        staff.extend([voice1, voice2])
        staff.is_simultaneous = True

    #right format
    notes = []
    satb = [""] * 4
    for chord in voiced_chords:
        for i, note in enumerate(chord):
            octave = note.octave
            name = str.lower(note.name)
            name += ("'" * (octave - 3) * (octave > 3) + "," * (3 - octave) *
                     (octave < 3) + "4 ")

            #builds the voices
            satb[i] += name

    soprano, alto, tenor, bass = satb

    #build the score

    upper_staff = abjad.Staff()
    lower_staff = abjad.Staff()
    satb_staff = abjad.StaffGroup([upper_staff, lower_staff])

    add2staff(soprano, alto, upper_staff)
    add2staff(tenor, bass, lower_staff)
    abjad.attach(abjad.Clef('bass'), lower_staff[0])

    abjad.show(satb_staff)
    abjad.play(satb_staff)
Esempio n. 11
0
def make_desordre_score(pitches):
    """
    Makes Désordre score.
    """

    assert len(pitches) == 2
    staff_group = abjad.StaffGroup(lilypond_type="PianoStaff")

    # build the music
    for hand in pitches:
        staff = make_desordre_staff(hand)
        staff_group.append(staff)

    # set clef and key signature to left hand staff
    leaf = abjad.inspect(staff_group[1]).leaf(0)
    abjad.attach(abjad.Clef("bass"), leaf)
    key_signature = abjad.KeySignature("b", "major")
    abjad.attach(key_signature, leaf)

    # wrap the piano staff in a score
    score = abjad.Score([staff_group])

    return score
Esempio n. 12
0
def make_desordre_score(pitches):
    '''Makes Désordre score.
    '''

    assert len(pitches) == 2
    staff_group = abjad.StaffGroup()
    staff_group.lilypond_type = 'PianoStaff'

    # build the music
    for hand in pitches:
        staff = abjad.demos.ligeti.make_desordre_staff(hand)
        staff_group.append(staff)

    # set clef and key signature to left hand staff
    leaf = abjad.inspect(staff_group[1]).get_leaf(0)
    clef = abjad.Clef('bass')
    abjad.attach(clef, leaf)
    key_signature = abjad.KeySignature('b', 'major')
    abjad.attach(key_signature, leaf)

    # wrap the piano staff in a score
    score = abjad.Score([staff_group])

    return score
Esempio n. 13
0
def make_bartok_score():
    score = abjad.Score()
    piano_staff = abjad.StaffGroup([], lilypond_type='PianoStaff')
    upper_staff = abjad.Staff([])
    lower_staff = abjad.Staff([])
    piano_staff.append(upper_staff)
    piano_staff.append(lower_staff)
    score.append(piano_staff)
    upper_measures = []
    upper_measures.append(abjad.Measure((2, 4), []))
    upper_measures.append(abjad.Measure((3, 4), []))
    upper_measures.append(abjad.Measure((2, 4), []))
    upper_measures.append(abjad.Measure((2, 4), []))
    upper_measures.append(abjad.Measure((2, 4), []))
    lower_measures = copy.deepcopy(upper_measures)
    upper_staff.extend(upper_measures)
    lower_staff.extend(lower_measures)
    upper_measures[0].extend("a'8 g'8 f'8 e'8")
    upper_measures[1].extend("d'4 g'8 f'8 e'8 d'8")
    upper_measures[2].extend("c'8 d'16 e'16 f'8 e'8")
    upper_measures[3].append("d'2")
    upper_measures[4].append("d'2")
    lower_measures[0].extend("b4 d'8 c'8")
    lower_measures[1].extend("b8 a8 af4 c'8 bf8")
    lower_measures[2].extend("a8 g8 fs8 g16 a16")
    upper_voice = abjad.Voice("b2", name='upper voice')
    command = abjad.LilyPondCommand('voiceOne')
    abjad.attach(command, upper_voice)
    lower_voice = abjad.Voice("b4 a4", name='lower voice')
    command = abjad.LilyPondCommand('voiceTwo')
    abjad.attach(command, lower_voice)
    lower_measures[3].extend([upper_voice, lower_voice])
    lower_measures[3].is_simultaneous = True
    upper_voice = abjad.Voice("b2", name='upper voice')
    command = abjad.LilyPondCommand('voiceOne')
    abjad.attach(command, upper_voice)
    lower_voice = abjad.Voice("g2", name='lower voice')
    command = abjad.LilyPondCommand('voiceTwo')
    abjad.attach(command, lower_voice)
    lower_measures[4].extend([upper_voice, lower_voice])
    lower_measures[4].is_simultaneous = True
    clef = abjad.Clef('bass')
    leaf = abjad.inspect(lower_staff).get_leaf(0)
    abjad.attach(clef, leaf)
    dynamic = abjad.Dynamic('pp')
    abjad.attach(dynamic, upper_measures[0][0])
    dynamic = abjad.Dynamic('mp')
    abjad.attach(dynamic, upper_measures[1][1])
    dynamic = abjad.Dynamic('pp')
    abjad.attach(dynamic, lower_measures[0][1])
    dynamic = abjad.Dynamic('mp')
    abjad.attach(dynamic, lower_measures[1][3])
    score.add_final_bar_line()
    abjad.selector = abjad.select().leaves()
    upper_leaves = abjad.selector(upper_staff)
    lower_leaves = abjad.selector(lower_staff)
    beam = abjad.Beam()
    abjad.attach(beam, upper_leaves[:4])
    beam = abjad.Beam()
    abjad.attach(beam, lower_leaves[1:5])
    beam = abjad.Beam()
    abjad.attach(beam, lower_leaves[6:10])
    slur = abjad.Slur()
    abjad.attach(slur, upper_leaves[:5])
    slur = abjad.Slur()
    abjad.attach(slur, upper_leaves[5:])
    slur = abjad.Slur()
    abjad.attach(slur, lower_leaves[1:6])
    crescendo = abjad.Hairpin('<')
    abjad.attach(crescendo, upper_leaves[-7:-2])
    diminuendo = abjad.Hairpin('>')
    abjad.attach(diminuendo, upper_leaves[-2:])
    markup = abjad.Markup('ritard.')
    text_spanner = abjad.TextSpanner()
    abjad.override(text_spanner).text_spanner.bound_details__left__text = markup
    abjad.attach(text_spanner, upper_leaves[-7:])
    tie = abjad.Tie()
    abjad.attach(tie, upper_leaves[-2:])
    note_1 = lower_staff[-2]['upper voice'][0]
    note_2 = lower_staff[-1]['upper voice'][0]
    notes = abjad.select([note_1, note_2])
    abjad.attach(abjad.Tie(), notes)
    return score
Esempio n. 14
0
 def _make_performer_staff_group(
     self,
     clef_name=None,
     instrument=None,
     number=None,
 ):
     import abjad
     if number is not None:
         name = '{} {}'.format(
             instrument.name.title(),
             number,
         )
     else:
         name = instrument.name.title()
     pitch_range = instrument.pitch_range
     staff_group = abjad.StaffGroup(
         lilypond_type='StringPerformerStaffGroup',
         name='{} Staff Group'.format(name),
     )
     tag_name = name.replace(' ', '')
     tag_string = r"\tag #'{}".format(tag_name)
     tag_command = abjad.LilyPondLiteral(tag_string, 'before')
     abjad.attach(tag_command, staff_group)
     if self.split_hands:
         lh_voice = abjad.Voice(
             [],
             lilypond_type='FingeringVoice',
             name='{} Fingering Voice'.format(name),
         )
         abbreviation = lh_voice.name.lower().replace(' ', '_')
         self.voice_abbreviations[abbreviation] = lh_voice.name
         lh_staff = abjad.Staff(
             [lh_voice],
             lilypond_type='FingeringStaff',
             name='{} Fingering Staff'.format(name),
         )
         lh_staff.is_simultaneous = True
         abjad.annotate(lh_staff, 'pitch_range', pitch_range)
         abjad.annotate(lh_staff, 'default_clef', abjad.Clef(clef_name))
         rh_voice = abjad.Voice(
             [],
             lilypond_type='BowingVoice',
             name='{} Bowing Voice'.format(name),
         )
         abbreviation = rh_voice.name.lower().replace(' ', '_')
         self.voice_abbreviations[abbreviation] = rh_voice.name
         rh_staff = abjad.Staff(
             [rh_voice],
             lilypond_type='BowingStaff',
             name='{} Bowing Staff'.format(name),
         )
         rh_staff.is_simultaneous = True
         staff_group.extend([rh_staff, lh_staff])
     else:
         lh_voice = abjad.Voice(
             [],
             lilypond_type='FingeringVoice',
             name='{} Voice'.format(name),
         )
         lh_staff = abjad.Staff(
             [lh_voice],
             lilypond_type='FingeringStaff',
             name='{} Staff'.format(name),
         )
         lh_staff.is_simultaneous = True
         abjad.annotate(lh_staff, 'pitch_range', pitch_range)
         abjad.annotate(lh_staff, 'default_clef', abjad.Clef(clef_name))
         staff_group.append(lh_staff)
     return staff_group, tag_name
Esempio n. 15
0
def configure_score(score):
    r'''Configures score.
    '''

    # configure bell staff
    bell_staff = score['Bell Staff']
    leaf = abjad.inspect(bell_staff).get_leaf(0)
    clef = abjad.Clef('treble')
    abjad.attach(clef, leaf)
    bells = abjad.instrumenttools.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).get_leaf(0)
    clef = abjad.Clef('treble')
    abjad.attach(clef, leaf)
    violin = abjad.instrumenttools.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).get_leaf(0)
    clef = abjad.Clef('treble')
    abjad.attach(clef, leaf)
    violin = abjad.instrumenttools.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']).get_leaf(0)
    clef = abjad.Clef('alto')
    abjad.attach(clef, leaf)
    viola = abjad.instrumenttools.Viola()
    abjad.attach(viola, leaf)

    # configure cello staff
    leaf = abjad.inspect(score['Cello Staff']).get_leaf(0)
    clef = abjad.Clef('bass')
    abjad.attach(clef, leaf)
    cello = abjad.instrumenttools.Cello()
    abjad.attach(cello, leaf)

    # configure bass staff
    leaf = abjad.inspect(score['Bass Staff']).get_leaf(0)
    clef = abjad.Clef('bass')
    abjad.attach(clef, leaf)
    contrabass = abjad.instrumenttools.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
Esempio n. 16
0
def test_reposition_clefs_07():
    staff = abjad.Staff([abjad.Note("c'2"),
                         abjad.Chord("<d' f'>2"),
                         abjad.Tuplet((2, 3), "g'2 a'2 b'2"),
                         ])
    abjad.attach(abjad.Clef('treble'), staff[0])
    abjad.attach(abjad.Clef('treble'), staff[2][1])
    assert format(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            \clef "treble"
            c'2
            <d' f'>2
            \times 2/3 {
                g'2
                \clef "treble"
                a'2
                b'2
            }
        }
        """)
    auxjad.mutate(staff[:]).reposition_clefs()
    assert format(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            \clef "treble"
            c'2
            <d' f'>2
            \times 2/3 {
                g'2
                a'2
                b'2
            }
        }
        """)
    staff = abjad.Staff([abjad.Note("c'2"),
                         abjad.Chord("<d' f'>2"),
                         abjad.Tuplet((2, 3), "g'2 a'2 b'2"),
                         ])
    abjad.attach(abjad.Clef('treble'), staff[2][1])
    assert format(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            c'2
            <d' f'>2
            \times 2/3 {
                g'2
                \clef "treble"
                a'2
                b'2
            }
        }
        """)
    auxjad.mutate(staff[:]).reposition_clefs()
    assert format(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            c'2
            <d' f'>2
            \times 2/3 {
                g'2
                a'2
                b'2
            }
        }
        """)
def post_process_voice_four(voice_four, score):
    print("post processing voice four")
    # delete and change durations
    voice_four[-2].written_duration = (1, 4)
    del voice_four[-1]
    voice_four[-1].written_duration = (3, 8)
    # abjad.mutate(voice_four[17]).transpose(-12)

    # numbered leaves
    selection = abjad.select(voice_four).leaves()
    for i, leaf in enumerate(selection):
        # abjad.attach(abjad.Markup(i), leaf)
        pass
        
    # change staff
    rh_staff = score['Piano_Staff'][0]
    lh_staff = score['Piano_Staff'][1]
    voice_four = score['LH_Voice_Four']

    staff_change1 = abjad.StaffChange(lh_staff)
    staff_change2 = abjad.StaffChange(rh_staff)
    abjad.attach(staff_change2, voice_four[-5])
    abjad.attach(staff_change1, voice_four[-2])
    
    voice_four[-3].written_pitch = "f''''"
    voice_four[-4].written_pitch = "g''"
    voice_four[14].written_pitch = "c'''"
    
    

    abjad.attach(abjad.Fermata(), voice_four[-1])

    clef3 = abjad.Clef("treble^8")
    clef3_range = abjad.pitch.PitchRange("[C6, +inf]")
    clef2 = abjad.Clef("treble")
    clef2_range = abjad.pitch.PitchRange("[D4, +inf]")
    clef1 = abjad.Clef("bass")
    clef1_range = abjad.pitch.PitchRange("[C1, C#4]")
    selection = abjad.select(voice_four).leaves()
    for i, leaf in enumerate(selection):
        # test3 = leaf in clef3_range
        test2 = leaf in clef2_range
        test1 = leaf in clef1_range
        test_note = not isinstance(leaf, abjad.Rest)
        # if test_note is True and test3 is True:
            # abjad.attach(clef3, voice_four[i])
        if test_note is True and test2 is True:
            abjad.attach(clef2, voice_four[i])
        if test_note is True and test1 is True:
            abjad.attach(clef1, voice_four[i])

    abjad.Accidental.respell_with_sharps(voice_four[8:9])
    abjad.Accidental.respell_with_sharps(voice_four[19:22])
    
    
    # REGISTER TRANSPOSITION
    abjad.mutate(voice_four).transpose(-12)
    #[:-7]

    # slurs
    start_slur = abjad.StartSlur()
    start_slur_down = abjad.StartSlur(direction=abjad.Down)
    stop_slur = abjad.StopSlur()

    abjad.attach(start_slur, voice_four[6])
    abjad.attach(stop_slur, voice_four[8])

    abjad.attach(start_slur, voice_four[12])
    abjad.attach(stop_slur, voice_four[15])

    abjad.attach(start_slur_down, voice_four[18])
    abjad.attach(stop_slur, voice_four[21])

    abjad.attach(start_slur_down, voice_four[-4])
    abjad.attach(stop_slur, voice_four[-3])

    # metronome mark IV
    abjad.attach(
        abjad.MetronomeMark(None, None, "meno mosso"), voice_four[-4])

    return voice_four
Esempio n. 18
0
abjad.Beam(upper_measures[1][1:])

abjad.Beam(upper_measures[2][0:3])
abjad.Beam(upper_measures[2][3:])

abjad.Tie(upper_staff[-2:])
abjad.Slur(upper_staff.leaves[0:5])
abjad.Slur(upper_staff.leaves[5:])
abjad.Crescendo(upper_staff.leaves[-7:-2])
abjad.Decrescendo(upper_staff.leaves[-2:])
tx = abjad.Text(upper_staff.leaves[-7:])
tx.bound_details__left__text = abjad.Markup("ritard.")

# lower staff

lower_staff.clef.forced = abjad.Clef("bass")

abjad.Tie([v1a[0], v1b[0]])

abjad.Beam(lower_staff.leaves[1:5])
abjad.Beam(lower_staff.leaves[6:10])
abjad.Beam(lower_staff.leaves[10:13])

abjad.Slur(lower_staff.leaves[1:6])
slr = abjad.Slur(lower_staff.leaves[6:13] + [v2a, v2b])
slr.position = Down

lower_staff.barline.kind = "||"

f(piano_staff)
show(piano_staff)
Esempio n. 19
0
def test_reposition_clefs_03():
    staff = abjad.Staff(r"c'1 | a,2 bf,4 r4 | f'1")
    abjad.attach(abjad.Clef('treble'), staff[0])
    abjad.attach(abjad.Clef('bass'), staff[1])
    abjad.attach(abjad.Clef('treble'), staff[4])
    assert format(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            \clef "treble"
            c'1
            \clef "bass"
            a,2
            bf,4
            r4
            \clef "treble"
            f'1
        }
        """)
    auxjad.mutate(staff[:]).reposition_clefs()
    assert format(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            \clef "treble"
            c'1
            \clef "bass"
            a,2
            bf,4
            r4
            \clef "treble"
            f'1
        }
        """)
    staff = abjad.Staff(r"c'1 | a,2 bf,4 r4 | f'1")
    abjad.attach(abjad.Clef('bass'), staff[1])
    abjad.attach(abjad.Clef('treble'), staff[4])
    assert format(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            c'1
            \clef "bass"
            a,2
            bf,4
            r4
            \clef "treble"
            f'1
        }
        """)
    auxjad.mutate(staff[:]).reposition_clefs()
    assert format(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            c'1
            \clef "bass"
            a,2
            bf,4
            r4
            \clef "treble"
            f'1
        }
        """)
Esempio n. 20
0
handlers.reverse()

maker = abjad.LeafMaker()
durations = [abjad.Duration((10, 4)) for _ in range(len(out_))]
leaves_1 = [abjad.Rest((3, 8))] + [maker(["c'"], durations)]
leaves_2 = [abjad.Rest(
    (3, 4))] + [maker(["c'"], durations)] + [abjad.Rest((3, 4))]
leaves_3 = [maker(["c"], durations)]

group = abjad.StaffGroup([
    abjad.Staff([abjad.Voice(leaves_1, name="violin 3")]),
    abjad.Staff([abjad.Voice(leaves_2, name="violin 4")]),
    abjad.Staff([abjad.Voice(leaves_3, name="viola 2")]),
])
abjad.attach(abjad.Clef("treble"), group[0][0][0])
abjad.attach(abjad.Clef("treble"), group[1][0][0])
abjad.attach(abjad.Clef("alto"), group[2][0][0])

# trio 2
voices = {
    "voice 1": [],
    "voice 2": [],
    "voice 3": [],
}

s = evans.RatioSegment(["1/1", "7/6", "3/2"])

instructions = [
    "2/3",
    "5/4",
Esempio n. 21
0
def see_pitches(pitches):
    """Show abjad.PitchSegment in two staffs."""
    G_staff = abjad.Staff()
    F_staff = abjad.Staff()
    staff_group = abjad.StaffGroup([G_staff, F_staff])
    pitch_range = abjad.PitchRange("[C4, +inf]")
    for pitch in pitches:
        test = pitch in pitch_range
        if test is True:
            note = abjad.Note.from_pitch_and_duration(pitch, (1, 1))
            G_staff.append(note)
            F_staff.append(abjad.Skip((1, 1)))
        if test is False:
            note = abjad.Note.from_pitch_and_duration(pitch, (1, 1))
            G_staff.append(abjad.Skip((1, 1)))
            F_staff.append(note)

    for i, note in enumerate(F_staff):
        abjad.attach(abjad.Markup(i), note)

    clef4 = abjad.Clef("treble^15")
    clef4_range = abjad.PitchRange("[G#7, +inf]")
    clef3 = abjad.Clef("treble^8")
    clef3_range = abjad.PitchRange("[G6, G7]")
    clef2 = abjad.Clef("treble")
    clef2_range = abjad.PitchRange("[E4, E5]")
    clef1 = abjad.Clef("bass")
    clef1_range = abjad.PitchRange("[A1, G3]")
    clef0 = abjad.Clef("bass_8")
    clef0_range = abjad.PitchRange("[-inf, C1]")

    selection = abjad.select(G_staff).leaves()
    for i, leaf in enumerate(selection):
        if isinstance(leaf, abjad.Note):
            test4 = leaf.written_pitch in clef4_range
            test3 = leaf.written_pitch in clef3_range
            test2 = leaf.written_pitch in clef2_range
            if test4 is True:
                abjad.attach(clef4, G_staff[i])
            elif test3 is True:
                abjad.attach(clef3, G_staff[i])
            elif test2 is True:
                abjad.attach(clef2, G_staff[i])

    selection2 = abjad.select(F_staff).leaves()
    for i, leaf in enumerate(selection2):
        if isinstance(leaf, abjad.Note):
            test3 = leaf.written_pitch in clef3_range
            test2 = leaf.written_pitch in clef2_range
            test1 = leaf.written_pitch in clef1_range
            test0 = leaf.written_pitch in clef0_range
            if test2 is True:
                abjad.attach(clef2, F_staff[i])
            elif test1 is True:
                abjad.attach(clef1, F_staff[i])
            elif test0 is True:
                abjad.attach(clef0, F_staff[i])

    abjad.show(staff_group)

    return staff_group
Esempio n. 22
0
def make_empty_score(
    flutes=0,
    oboes=0,
    english_horn=0,
    clarinets=0,
    bass_clarinet=0,
    bassoons=0,
    horns=0,
    trumpets=0,
    trombones=0,
    tuba=0,
    harp=0,
    piano=0,
    percussion=0,
    first_violins=0,
    second_violins=0,
    violas=0,
    cellos=0,
    contrabasses=0,
):
    tag = baca.site(inspect.currentframe())
    global_context = baca.score.make_global_context()
    flute_staves = _make_staves(
        "Flute",
        flutes,
        instruments["Flute"],
        margin_markups["Fl."],
        abjad.Clef("treble"),
    )
    oboe_staves = _make_staves(
        "Oboe",
        oboes,
        instruments["Oboe"],
        margin_markups["Ob."],
        abjad.Clef("treble"),
    )
    english_horn_staves = _make_staves(
        "English.Horn",
        english_horn,
        instruments["EnglishHorn"],
        margin_markups["Eng. hn."],
        abjad.Clef("treble"),
    )
    clarinet_staves = _make_staves(
        "Clarinet",
        clarinets,
        instruments["Clarinet"],
        margin_markups["Cl."],
        abjad.Clef("treble"),
    )
    bass_clarinet_staves = _make_staves(
        "Bass.Clarinet",
        bass_clarinet,
        instruments["BassClarinet"],
        margin_markups["B. cl."],
        abjad.Clef("treble"),
    )
    bassoon_staves = _make_staves(
        "Bassoon",
        bassoons,
        instruments["Bassoon"],
        margin_markups["Bsn."],
        abjad.Clef("bass"),
    )
    horn_staves = _make_staves(
        "Horn",
        horns,
        instruments["Horn"],
        margin_markups["Hn."],
        abjad.Clef("bass"),
    )
    trumpet_staves = _make_staves(
        "Trumpet",
        trumpets,
        instruments["Trumpet"],
        margin_markups["Tp."],
        abjad.Clef("treble"),
    )
    trombone_staves = _make_staves(
        "Trombone",
        trombones,
        instruments["Trombone"],
        margin_markups["Trb."],
        abjad.Clef("tenor"),
    )
    tuba_staves = _make_staves(
        "Tuba",
        tuba,
        instruments["Tuba"],
        margin_markups["Tub."],
        abjad.Clef("bass"),
    )
    harp_staves = _make_staves(
        "Harp",
        harp,
        instruments["Harp"],
        margin_markups["Hp."],
        abjad.Clef("treble"),
    )
    piano_staves = _make_staves(
        "Piano",
        piano,
        instruments["Piano"],
        margin_markups["Pf."],
        abjad.Clef("treble"),
    )
    percussion_staves = _make_staves(
        "Percussion",
        percussion,
        instruments["Percussion"],
        margin_markups["Perc."],
        abjad.Clef("percussion"),
    )
    first_violin_staves = _make_staves(
        "First.Violin",
        first_violins,
        instruments["Violin"],
        margin_markups["Vni. I"],
        abjad.Clef("treble"),
    )
    second_violin_staves = _make_staves(
        "Second.Violin",
        second_violins,
        instruments["Violin"],
        margin_markups["Vni. II"],
        abjad.Clef("treble"),
    )
    viola_staves = _make_staves(
        "Viola",
        violas,
        instruments["Viola"],
        margin_markups["Vle."],
        abjad.Clef("alto"),
    )
    cello_staves = _make_staves(
        "Cello",
        cellos,
        instruments["Cello"],
        margin_markups["Vc."],
        abjad.Clef("bass"),
    )
    contrabass_staves = _make_staves(
        "Contrabass",
        contrabasses,
        instruments["Contrabass"],
        margin_markups["Cb."],
        abjad.Clef("bass"),
    )
    music_context = baca.score.make_music_context(
        baca.score.make_staff_group(
            "Wind",
            *_group_families(
                (
                    "FluteFamily",
                    _make_square_staff_group("Flute", *flute_staves),
                ),
                (
                    "OboeFamily",
                    _make_square_staff_group("Oboe", *oboe_staves),
                    _make_square_staff_group("EnglishHorn", *
                                             english_horn_staves),
                ),
                (
                    "ClarinetFamily",
                    _make_square_staff_group("Clarinet", *clarinet_staves),
                    _make_square_staff_group("BassClarinet", *
                                             bass_clarinet_staves),
                ),
                (
                    "BassoonFamily",
                    _make_square_staff_group("Bassoon", *bassoon_staves),
                ),
            ),
        ),
        baca.score.make_staff_group(
            "Brass",
            _make_square_staff_group("Horn", *horn_staves),
            _make_square_staff_group("Trumpet", *trumpet_staves),
            _make_square_staff_group("Trombone", *trombone_staves),
            _make_square_staff_group("Tuba", *tuba_staves),
        ),
        _make_piano_staff("Piano", *piano_staves),
        _make_piano_staff("Harp", *harp_staves),
        baca.score.make_staff_group("Percussion", *percussion_staves),
        baca.score.make_staff_group(
            "String",
            _make_square_staff_group("FirstViolin", *first_violin_staves),
            _make_square_staff_group("SecondViolin", *second_violin_staves),
            _make_square_staff_group("Viola", *viola_staves),
            _make_square_staff_group("Cello", *cello_staves),
            _make_square_staff_group("Contrabass", *contrabass_staves),
        ),
    )
    score = abjad.Score([global_context, music_context], name="Score", tag=tag)
    baca.score.assert_lilypond_identifiers(score)
    baca.score.assert_unique_context_names(score)
    baca.score.assert_matching_custom_context_names(score)
    return score
Esempio n. 23
0
File: test.py Progetto: gsy/gmajor
            elif _tie.attrib['type'] == 'stop':
                tie_end = len(notes)
                ties.append((tie_start, tie_end))

    measure = Measure(TimeSignature((4, 4)), notes)
    for tie_start, tie_stop in ties:
        abjad.attach(abjad.Tie(), measure[tie_start:tie_stop])

    abjad.setting(measure).auto_beaming = False
    for beam_start, beam_end in beams:
        beam = abjad.Beam()
        abjad.attach(beam, measure[beam_start:beam_end])

    measures.append(measure)

clef = abjad.Clef('treble_8')
abjad.attach(clef, measures[0][0])

staff = abjad.Staff(measures)
# staff = abjad.Staff(measures, lilypond_type='TabStaff')
# show(staff)

for x in abjad.persist(staff).as_midi():
    x
    print(x)

# abjad.show(staff)
output = abjad.persist(staff).as_ly()
out_file = output[0]
command = "lilypond -dpreview -dbackend=svg {}".format(out_file)
print(command)
Esempio n. 24
0
 def __init__(self, name: str) -> None:
     self.abjad = abjad.Clef(name)
Esempio n. 25
0
    def to_pitch(self, clef='treble'):
        """
        Makes named pitch from staff position and `clef`.

        ..  container:: example

            Treble clef:

            >>> clef = abjad.Clef('treble')
            >>> for n in range(-6, 6):
            ...     staff_position = abjad.StaffPosition(n)
            ...     pitch = staff_position.to_pitch(clef=clef)
            ...     message = '{!s}\t{}'.format(staff_position, pitch)
            ...     print(message)
            ...
            StaffPosition(-6)	c'
            StaffPosition(-5)	d'
            StaffPosition(-4)	e'
            StaffPosition(-3)	f'
            StaffPosition(-2)	g'
            StaffPosition(-1)	a'
            StaffPosition(0)	b'
            StaffPosition(1)	c''
            StaffPosition(2)	d''
            StaffPosition(3)	e''
            StaffPosition(4)	f''
            StaffPosition(5)	g''

        ..  container:: example

            Bass clef:

            >>> clef = abjad.Clef('bass')
            >>> for n in range(-6, 6):
            ...     staff_position = abjad.StaffPosition(n)
            ...     pitch = staff_position.to_pitch(clef=clef)
            ...     message = '{!s}\t{}'.format(staff_position, pitch)
            ...     print(message)
            ...
            StaffPosition(-6)	e,
            StaffPosition(-5)	f,
            StaffPosition(-4)	g,
            StaffPosition(-3)	a,
            StaffPosition(-2)	b,
            StaffPosition(-1)	c
            StaffPosition(0)	d
            StaffPosition(1)	e
            StaffPosition(2)	f
            StaffPosition(3)	g
            StaffPosition(4)	a
            StaffPosition(5)	b

        ..  container:: example

            Alto clef:

            >>> clef = abjad.Clef('alto')
            >>> for n in range(-6, 6):
            ...     staff_position = abjad.StaffPosition(n)
            ...     pitch = staff_position.to_pitch(clef=clef)
            ...     message = '{!s}\t{}'.format(staff_position, pitch)
            ...     print(message)
            ...
            StaffPosition(-6)	d
            StaffPosition(-5)	e
            StaffPosition(-4)	f
            StaffPosition(-3)	g
            StaffPosition(-2)	a
            StaffPosition(-1)	b
            StaffPosition(0)	c'
            StaffPosition(1)	d'
            StaffPosition(2)	e'
            StaffPosition(3)	f'
            StaffPosition(4)	g'
            StaffPosition(5)	a'

        ..  container:: example

            Percussion clef:

            >>> clef = abjad.Clef('percussion')
            >>> for n in range(-6, 6):
            ...     staff_position = abjad.StaffPosition(n)
            ...     pitch = staff_position.to_pitch(clef=clef)
            ...     message = '{!s}\t{}'.format(staff_position, pitch)
            ...     print(message)
            ...
            StaffPosition(-6)	d
            StaffPosition(-5)	e
            StaffPosition(-4)	f
            StaffPosition(-3)	g
            StaffPosition(-2)	a
            StaffPosition(-1)	b
            StaffPosition(0)	c'
            StaffPosition(1)	d'
            StaffPosition(2)	e'
            StaffPosition(3)	f'
            StaffPosition(4)	g'
            StaffPosition(5)	a'

        Returns new named pitch.
        """
        import abjad
        clef = abjad.Clef(clef)
        offset_staff_position_number = self.number
        offset_staff_position_number -= clef.middle_c_position.number
        offset_staff_position = type(self)(offset_staff_position_number)
        octave_number = offset_staff_position.number // 7 + 4
        diatonic_pc_number = offset_staff_position.number % 7
        pitch_class_number = constants._diatonic_pc_number_to_pitch_class_number[
            diatonic_pc_number]
        pitch_number = 12 * (octave_number - 4)
        pitch_number += pitch_class_number
        named_pitch = abjad.NamedPitch(pitch_number)
        return named_pitch
Esempio n. 26
0
markup1 = abjad.Markup(r"\bold { A }")
markup2 = abjad.Markup(r"\bold { B }")
markup3 = abjad.Markup(r"\bold { C }")
markup4 = abjad.Markup(r"\bold { D }")
markup5 = abjad.Markup(r"\bold { E }")
markup6 = abjad.Markup(r"\bold { F }")
mark1 = abjad.RehearsalMark(markup=markup1)
mark2 = abjad.RehearsalMark(markup=markup2)
mark3 = abjad.RehearsalMark(markup=markup3)
mark4 = abjad.RehearsalMark(markup=markup4)
mark5 = abjad.RehearsalMark(markup=markup5)
mark6 = abjad.RehearsalMark(markup=markup6)

instruments1 = cyc([abjad.Flute(), abjad.AltoSaxophone(), abjad.Cello()])

clefs1 = cyc([abjad.Clef("treble"), abjad.Clef("treble"), abjad.Clef("bass")])

abbreviations1 = cyc([
    abjad.MarginMarkup(markup=abjad.Markup("fl.")),
    abjad.MarginMarkup(markup=abjad.Markup("sx.")),
    abjad.MarginMarkup(markup=abjad.Markup("vc.")),
])

names1 = cyc([
    abjad.StartMarkup(markup=abjad.Markup("Flute")),
    abjad.StartMarkup(markup=abjad.Markup("Saxophone")),
    abjad.StartMarkup(markup=abjad.Markup("Violoncello")),
])

for staff in abjad.iterate(score["Staff Group 1"]).components(abjad.Staff):
    leaf1 = abjad.select(staff).leaves()[0]
Esempio n. 27
0
def sscore_to_abjad_score(sscore):
    globals = _Globals()
    score = abjad.Score(context_name='Score')

    sig = abjad.TimeSignature((1, 4))

    # don't just use the score object since we're alternating lyrics blocks
    # ooh it can be tuples (Voice, _Lyrics)
    voices = []

    # create a staff of empty measures for each jig
    for i in range(0, sscore['jigs']):
        voice = abjad.Voice(name=globals.iToStaff(i))

        for beat in range(0, sscore['beats']):
            measure = abjad.Measure(sig, "r4")
            voice.extend(measure)

        # only now that the staves have content can we set their clef
        leaf = abjad.inspect(voice).get_leaf()
        abjad.attach(abjad.Clef('alto'), leaf)

        score.append(voice)

        lyrics = _Lyrics(globals.iToStaff(i))
        score.append(lyrics)
        voices.append((voice, lyrics))
    nextState = 0
    for beat in range(0, sscore['beats']):
        while sscore['states'][nextState].beat <= beat + 1:
            # thanks python for making me write this twice
            state = sscore['states'][nextState]
            snote = state.noteObj
            pitch = globals.lilypondPitch(snote)

            # generate correct amount of rest before the note begins
            # assume powers of 2 (no tuplets, sorry boiz)
            restBeats = state.beat % 1
            if restBeats != 0:
                rest16ths = int(restBeats / 0.25)
                rest = abjad.Rest(abjad.Duration(rest16ths, 16))

                noteBeats = 1 - restBeats
                note16ths = int(noteBeats / 0.25)
                anote = abjad.Note()
                anote.written_pitch = pitch
                anote.written_duration = abjad.Duration(note16ths, 16)
                measure = abjad.Measure(sig, [rest, anote])
            else:
                anote = abjad.Note()
                anote.written_pitch = pitch
                anote.written_duration = abjad.Duration(1, 4)
                measure = abjad.Measure(sig, [anote])
            # what if the measure already contained a note this beat?
            # eh that's a risk I'm willing to take

            voiceTuple = voices[state.singamajigIndex]
            voiceTuple[0][beat] = measure
            voiceTuple[1].add_lyric(snote['syllable'])

            nextState += 1
            if nextState >= len(sscore['states']):
                break

    return score
Esempio n. 28
0
    def __illustrate__(self):
        r"""
        Illustrates pitch range.

        ..  container:: example

            >>> pitch_range = abjad.PitchRange('[C3, C7]')
            >>> abjad.show(pitch_range) # doctest: +SKIP

            ..  docs::

                >>> lilypond_file = pitch_range.__illustrate__()
                >>> abjad.f(lilypond_file[abjad.Score])
                \new Score
                \with
                {
                    \override BarLine.stencil = ##f
                    \override Glissando.thickness = #2
                    \override SpanBar.stencil = ##f
                    \override TimeSignature.stencil = ##f
                }
                <<
                    \new PianoStaff
                    <<
                        \context Staff = "Treble Staff"
                        {
                            \clef "treble"
                            s1 * 1/4
                            s1 * 1/4
                        }
                        \context Staff = "Bass Staff"
                        {
                            \clef "bass"
                            c1 * 1/4
                            \glissando
                            \change Staff = "Treble Staff"
                            c''''1 * 1/4
                        }
                    >>
                >>

        Returns LilyPond file.
        """
        import abjad
        start_pitch_clef = abjad.Clef.from_selection(self.start_pitch)
        stop_pitch_clef = abjad.Clef.from_selection(self.stop_pitch)
        start_note = abjad.Note(self.start_pitch, 1)
        stop_note = abjad.Note(self.stop_pitch, 1)
        glissando = abjad.Glissando()
        if start_pitch_clef == stop_pitch_clef:
            if start_pitch_clef == abjad.Clef('bass'):
                bass_staff = abjad.Staff()
                abjad.attach(abjad.Clef('bass'), bass_staff)
                bass_staff.extend([start_note, stop_note])
                bass_leaves = abjad.select(bass_staff).leaves()
                abjad.attach(glissando, bass_leaves)
                score = abjad.Score([bass_staff])
            else:
                treble_staff = abjad.Staff()
                abjad.attach(abjad.Clef('treble'), treble_staff)
                treble_staff.extend([start_note, stop_note])
                treble_leaves = abjad.select(treble_staff).leaves()
                abjad.attach(glissando, treble_leaves)
                score = abjad.Score([treble_staff])
        else:
            result = abjad.Score.make_piano_score()
            score, treble_staff, bass_staff = result
            bass_staff.extend([start_note, stop_note])
            treble_staff.extend(abjad.Skip(1) * 2)
            bass_leaves = abjad.select(bass_staff).leaves()
            abjad.attach(glissando, bass_leaves)
            abjad.attach(abjad.StaffChange(treble_staff), bass_staff[1])
            abjad.attach(abjad.Clef('treble'), treble_staff[0])
            abjad.attach(abjad.Clef('bass'), bass_staff[0])
        for leaf in abjad.iterate(score).leaves():
            abjad.attach(abjad.Multiplier(1, 4), leaf)
        abjad.override(score).bar_line.stencil = False
        abjad.override(score).span_bar.stencil = False
        abjad.override(score).glissando.thickness = 2
        abjad.override(score).time_signature.stencil = False
        lilypond_file = abjad.LilyPondFile.new(score)
        return lilypond_file
Esempio n. 29
0
                        upper_abjad_chord.note_heads.extend(
                            [upper_pitches[i].midi_number - 60])
                        if upper_pitches[i].is_harmonic_tone == False:
                            abjad.tweak(upper_abjad_chord.note_heads[i]
                                        ).style = 'harmonic'
                    upper_staff_components.append(upper_abjad_chord)
                else:
                    upper_staff_components.append(
                        abjad.Rest(abjad.Duration(1, 1)))

            lower_staff = abjad.Staff(lower_staff_components)
            upper_staff = abjad.Staff(upper_staff_components)

            if len(lower_staff_components) > 0:
                leaf = abjad.get.leaf(lower_staff, 0)
                abjad.attach(abjad.Clef('bass'), leaf)

            piano_staff = abjad.StaffGroup([], lilypond_type='PianoStaff')
            piano_staff.append(upper_staff)
            piano_staff.append(lower_staff)

            abjad.show(piano_staff)

        else:

            print("Nothing to notate!")

elif mode_text.lower() == "write":

    if len(sys.argv) < 4:
        raise ValueError("No string provided to write to file")
Esempio n. 30
0
print('Adding attachments ...')

instruments = cyc([
    abjad.SopraninoSaxophone(),
])

abbreviations = cyc([
    abjad.MarginMarkup(markup=abjad.Markup(' '), ),
])

names = cyc([
    abjad.StartMarkup(markup=abjad.Markup('Fundamental Harmony'), ),
])

clefs = cyc([
    abjad.Clef('treble'),
    abjad.Clef('bass'),
])

for staff in abjad.iterate(score['Staff Group']).components(abjad.Staff):
    leaf1 = abjad.select(staff).leaves()[0]
    # abjad.attach(next(instruments), leaf1)
    # abjad.attach(next(abbreviations), leaf1)
    # abjad.attach(next(names), leaf1)
    abjad.attach(next(clefs), leaf1)

for staff in abjad.select(score['Staff 1']).components(abjad.Staff):
    prototype = abjad.NamedIntervalClass
    abjad.label(staff).with_intervals(prototype=None)

for staff in abjad.select(score['Staff Group']).components(abjad.Staff):