Exemplo n.º 1
0
 def process_leaf(self, leaf: abjad.Leaf) -> abjad.Leaf:
     abjad.attach(
         abjad.Markup(
             contents="\\small {}-{} s".format(*self.waiting_range), direction="^"
         ),
         leaf,
     )
     abjad.attach(
         abjad.Fermata(self.fermata_type),
         leaf,
     )
     return leaf
Exemplo n.º 2
0
def post_process_voice_four(voice_four, score):
    print("post processing voice four")
    respell(voice_four)
    custom_ties(voice_four)
    change_clef(voice_four)
    # numbered leaves
    selection = abjad.select(voice_four).leaves()
    for i, leaf in enumerate(selection):
        # abjad.attach(abjad.Markup(i), leaf)  ###################################### numerate leaves
        pass
    abjad.mutate(selection[63:66]).transpose(-12)
    del selection[66].note_heads[-1]
    selection[66].note_heads.extend([-13])

    abjad.mutate(selection[67]).transpose(-12)
    del selection[68].note_heads[-1]
    selection[68].note_heads.extend([-13])
    del voice_four[-4:]
    voice_four.append("<c, ds,>2.")
    voice_four.append('r2.')
    abjad.attach(abjad.Fermata(), voice_four[-1])
    place = abjad.Markup(
        "Pelotas - RS.",
        direction=abjad.Down,
    )
    date = abjad.Markup("May - December 2020.")
    markup = abjad.Markup.right_column(
        [place, date],
        direction=abjad.Down,
    )
    markup = markup.italic()
    markup = score.add_final_markup(
        markup,
        extra_offset=(14.5, -2),
    )
    bar_line = score.add_final_bar_line()

    return voice_four
Exemplo n.º 3
0
# -*- encoding: utf-8 -*-
import os
import abjad
from organi.tools import SegmentMaker

# TIME SIGNATURES
time_signatures = [(4, 4)]

# ORGAN NOTATION
rest_organ = abjad.Rest("r1")
abjad.attach(abjad.Fermata("verylongfermata"), rest_organ)
rest_organ_voice_four = abjad.Rest("r1")

# CHORD ZERO ELECTRONICS
chord_zero_electronics = abjad.Chord(
    "<cqs' f' gs' c'' e'' ftqs'' gqs'' gs''" +
    " b'' cs''' ctqs''' f''' fs''' ftqs''' gs'''>1")

# laisses vibrer
laissez_vibrer = abjad.LaissezVibrer()
abjad.attach(laissez_vibrer, chord_zero_electronics)

# tempo mark
mark = abjad.MetronomeMark(None, None, "Statico")
abjad.attach(mark, chord_zero_electronics)

# fermata
abjad.attach(abjad.Fermata("verylongfermata"), chord_zero_electronics)

# remove includes to collect segments
includes = ['../../stylesheets/stylesheet.ily']
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
Exemplo n.º 5
0
 def __init__(self, *args, **kwargs) -> None:
     self.abjad = abjad.Fermata(*args, **kwargs)
Exemplo n.º 6
0
 def __init__(self, command: str = "fermata") -> None:
     self.abjad = abjad.Fermata(command)
Exemplo n.º 7
0
def _make(music):
    del music[-1]
    abjad.attach(abjad.Fermata(), music[-1])
    return music
Exemplo n.º 8
0
def ChopinPrelude20():

    #Use the following libraries to access required modules.
    import abjad
    import copy

    # Initialize the piano score and create empty upper/lower measure lists.
    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 = []
    lower_measures = copy.deepcopy(upper_measures)

    #Create tuples containing notes and chords for the upper and lower measures. Comments are in same listed order as each variable below.
    #
    #upper_tuple1: contains chords for first four upper measures except for the third beat in each measure.
    #upper_tuple_repeat1: bars 5-8 repeat themselves in bars 9-12, so only write these notes once.
    #upper_tuple_repeat: Concatenate upper_tuple_repeat1 twice to create the entire repeated section bars 5-12.
    #upper_tuple: Concatenate upper_tuple1 and upper_tuple_repeat to get just one tuple for entire upper measure.
    #lower_tuple1: contains chords for first four lower measures.
    #lower_tuple_repeat1: bars 5-8 repeat themselves in bars 9-12, so only write these notes once.
    #lower_tuple_repeat: Concatenate lower_tuple_repeat1 twice to create the entire repeated section bars 5-12
    #lower_tuple: Concatenate lower_tuple1 and lower_tuple_repeat to get just one tuple for entire lower measure
    #
    #The third beat in each upper measure contains two voices;
    #voice_1_tuple1: contains notes for upper voice for first four upper measures.
    #voice_1_tuple_repeat1: bars 5-8 repeat themselves in bars 9-12, so only write these notes once for upper voice.
    #voice_1_tuple_repeat: Concatenate voice_1_tuple_repeat1 twice to create the entire repeated section bars 5-12.
    #voice_1_tuple: Concatenate voice_1_tuple1 and voice_1_tuple_repeat to get one tuple for entire upper measure third beat upper voice.
    #voice_2_tuple1: contains notes for lower voice for first four upper measures.
    #voice_2_tuple_repeat1: bars 5-8 repeat themselves in bars 9-12, so only write these notes once for lower voice.
    #voice_2_tuple_repeat: Concatenate voice_2_tuple_repeat1 twice to create the entire repeated section bars 5-12.
    #voice_2_tuple: Concatenate voice_2_tuple1 and voice_2_tuple_repeat to get one tuple for entire upper measure third beat lower voice.

    upper_tuple1 = (r"<g c' ef' g'>4 <af c' ef' af'>4 <ef g c' ef'>4",
                    r"<ef af c' ef'>4 <f af df' f'>4 <c ef af c'>4",
                    r"<d f b d'>4 <e g bf c' e'>4 <g c' ef'>4",
                    r"<fs c' d'>4 <g b d' g'>4 <b d' g'>4")
    upper_tuple_repeat1 = (r"<ef' g' ef''>4 <ef' af' ef''>4 <d' g' d''>4",
                           r"<c' g' c''>4 <c' d' fs' d''>4 <b d' g'>4",
                           r"<c' g' c''>4 <af c' af'>4 <g c' ef'>4",
                           r"<ef af c' ef'>4 <f af df' f'>4 <ef g c'>4")
    upper_tuple_repeat = upper_tuple_repeat1 + upper_tuple_repeat1
    upper_tuple = upper_tuple1 + upper_tuple_repeat
    lower_tuple1 = (r"<c c,>4 <f,, f,>4 <g,, g,>4 <c, g, c>4",
                    r"<af, af,,>4 <df, df,,>4 <ef, ef,,>4 <af, af,,>4",
                    r"<g, g,,>4 <c, c,,>4 <f, f,,>4 <c c,>4",
                    r"<d a, d,>4 <g, g,,>4 <d, d,,>4 <g, g,,>4")
    lower_tuple_repeat1 = (r"<c c,>4 <c c'>4 <b b,>4 <bf bf,>4",
                           r"<a a,>4 <af af,>4 <g g,>4 <f f,>4",
                           r"<ef ef,>4 <f f,>4 <b, b,,>4 <c c,>4",
                           r"<af, af,,>4 <df, df,,>4 <g, g,,>4 <c, c,,>4")
    lower_tuple_repeat = lower_tuple_repeat1 + lower_tuple_repeat1
    lower_tuple = lower_tuple1 + lower_tuple_repeat
    voice_1_tuple1 = (r"<ef' g'>8. <d' f'>16", r"<c' ef'>8. <bf df'>16",
                      r"g'8. f'16", r"b'8. a'16")
    voice_1_tuple_repeat1 = (r"<d' d''>4", r"<g' b'>8. a'16", r"g'8. f'16",
                             r"ef'8. d'16")
    voice_1_tuple_repeat = voice_1_tuple_repeat1 + voice_1_tuple_repeat1
    voice_1_tuple = voice_1_tuple1 + voice_1_tuple_repeat
    voice_2_tuple1 = (r"<g b>4", r"<df ef g>4", r"<af c'>4", r"<c' d' fs'>4")
    voice_2_tuple_repeat1 = (r"af'8. fs'16", r"d'8. c'16", r"<g d'>4",
                             r"<f g b>4")
    voice_2_tuple_repeat = voice_2_tuple_repeat1 + voice_2_tuple_repeat1
    voice_2_tuple = voice_2_tuple1 + voice_2_tuple_repeat

    # Executing this while loop does the following:
    # 1: Appends upper and lower measures to the piano staff at each iteration.
    # 2: These measures are populated with the tuples defined above.
    # 3: The upper and lower voices are treated separately; a container is created for the third beat,
    # then is inserted into correct position in upper measures.
    i = 0
    while i < 12:
        upper_measures.append(abjad.Measure((4, 4), []))
        lower_measures.append(abjad.Measure((4, 4), []))
        upper_measures[i].extend(upper_tuple[i])
        lower_measures[i].extend(lower_tuple[i])
        voice_1 = abjad.Voice(voice_1_tuple[i])
        voice_2 = abjad.Voice(voice_2_tuple[i])
        literal_1 = abjad.LilyPondLiteral(r"\voiceOne")
        literal_2 = abjad.LilyPondLiteral(r"\voiceTwo")
        abjad.attach(literal_1, voice_1[0])
        abjad.attach(literal_2, voice_2[0])
        container = abjad.Container([voice_1, voice_2], is_simultaneous=True)
        upper_measures[i].insert(2, container)

        i += 1

    # Initialize final empty measure for final chord
    upper_measures.append(abjad.Measure((4, 4), []))
    lower_measures.append(abjad.Measure((4, 4), []))

    # Append the chords to the final measures
    upper_measures[12].append(r"<c' ef' g' c''>1")
    lower_measures[12].append("<c g>1")

    # Extend the intial piano staff to include the measures created above
    upper_staff.extend(upper_measures)
    lower_staff.extend(lower_measures)

    # Set and place clefs throughput piece
    leaf1 = abjad.inspect(lower_staff).leaf(0)
    leaf2 = abjad.inspect(upper_staff).leaf(0)
    leaf3 = abjad.inspect(upper_staff).leaf(20)
    leaf4 = abjad.inspect(upper_staff).leaf(43)
    leaf5 = abjad.inspect(upper_staff).leaf(49)
    leaf6 = abjad.inspect(upper_staff).leaf(68)
    leaf7 = abjad.inspect(upper_staff).leaf(74)
    abjad.attach(abjad.Clef('bass'), leaf1)
    abjad.attach(abjad.Clef('bass'), leaf2)
    abjad.attach(abjad.Clef('treble'), leaf3)
    abjad.attach(abjad.Clef('bass'), leaf4)
    abjad.attach(abjad.Clef('treble'), leaf5)
    abjad.attach(abjad.Clef('bass'), leaf6)
    abjad.attach(abjad.Clef('treble'), leaf7)

    # Set key signature for left and right hand
    key_signature = abjad.KeySignature('c', 'minor')
    abjad.attach(key_signature, leaf1)
    key_signature2 = abjad.KeySignature('c', 'minor')
    abjad.attach(key_signature2, leaf2)

    # Attach necessary dynamics to piece and insert in correct positions
    abjad.attach(abjad.Dynamic('ff'), upper_measures[0][0])
    abjad.attach(abjad.Dynamic('p'), upper_measures[4][0])
    abjad.attach(abjad.Dynamic('pp'), upper_measures[8][0])
    abjad.attach(abjad.Dynamic('p'), upper_measures[12][0])

    # Add bar line after measure 12
    score.add_final_bar_line()

    # Add tempo and other markups to piece at required positions
    markup = abjad.Markup('Largo', direction=abjad.Up).italic()
    abjad.attach(markup, upper_measures[0][0])

    markup2 = abjad.Markup('riten.', direction=abjad.Up).italic()
    abjad.attach(markup2, upper_measures[6][3])

    markup3 = abjad.Markup('cresc.', direction=abjad.Down).italic()
    abjad.attach(markup3, upper_measures[9][1])

    # Add fermata to last chord of piece
    fermata = abjad.Fermata()
    abjad.attach(fermata, upper_measures[12][0])
    abjad.attach(fermata, lower_measures[12][0])

    # Add accent to last chord of piece
    accent = abjad.Articulation('accent')
    abjad.attach(accent, upper_measures[12][0])

    # Initialize the final lilypond file for formatting
    sheetmusic_file = abjad.LilyPondFile.new(
        music=score,
        global_staff_size=20,
        default_paper_size=('A5', 'portait'),
    )

    # Add title, composer, etc. to the sheet
    sheetmusic_file.header_block.title = abjad.Markup('Prelude')
    sheetmusic_file.header_block.composer = abjad.Markup('Frederic Chopin')
    sheetmusic_file.header_block.tagline = abjad.Markup(
        'Written in Python using the Abjad library and Lilypond engraving software - Wesley Olsen'
    )
    sheetmusic_file.header_block.subsubtitle = abjad.Markup('Op. 20 No. 28')

    # Create Lilypond file and .pdf
    abjad.show(sheetmusic_file)
Exemplo n.º 9
0
#!/usr/local/bin/python3.7
# -*- encoding: utf-8 -*-
import os
import abjad
from organi.tools import SegmentMaker
from organi.materials.pitches import pitches_I as pitches
from organi.materials.rhythm import rhythm_makers_I as rhythm
from organi.materials.indicators import post_process_I as indicators

# SEGMENT 1

rest_organ = abjad.Rest("r1")
abjad.attach(abjad.Fermata("verylongfermata"), rest_organ)

durations_voice_one = [(6, 8)] * 8
durations_voice_four = [(6, 8)] * 8

time_signatures = (4, 4), (6, 8), (6, 8), (6, 8), (6, 8), (6, 8), (6,
                                                                   8), (6,
                                                                        8), (6,
                                                                             8)

includes = ['../../stylesheets/stylesheet.ily']

segment_maker = SegmentMaker(
    time_signatures=time_signatures,
    durations_voice_one=durations_voice_one,
    rhythm_maker_voice_one=rhythm.rhythm_maker_voice_one,
    pitches_voice_one=pitches.chord_voice_one,
    initial_rest_voice_one=rest_organ,
    make_those_chords_voice_one=True,
Exemplo n.º 10
0
def main() -> versemaker.Verse:
    vm = versemaker.VerseMaker(
        59,
        "closing",
        tempo_factor=0.31,
        octave_of_first_pitch=-1,
        harmonic_tolerance=0.89,
        ro_temperature=0.685,
        ro_density=0.8,
        harmonic_pitches_tonality_flux_maximum_octave_difference_from_melody_pitch=(
            1,
            0,
        ),
        harmonic_pitches_complex_interval_helper_maximum_octave_difference_from_melody_pitch=(
            1,
            0,
        ),
        area_density_maker=infit.Gaussian(0.35, 0.1),
        area_density_reference_size=F(1, 2),
        area_min_split_size=F(1, 8),
    )

    vm.remove_area(0, 1)
    # vm.remove_area(30, len(vm.bars))
    # vm.remove_area(len(vm.bars) - 2, len(vm.bars) + 1)
    vm.add_bar(5, abjad.TimeSignature((3, 4)))
    vm.add_bar(9, abjad.TimeSignature((2, 4)))
    vm.add_bar(23, abjad.TimeSignature((1, 4)))
    vm.add_bar(25, abjad.TimeSignature((2, 4)))
    # vm.add_bar(26, abjad.TimeSignature((1, 4)))

    vm.attach(
        violin=strings.SimpleStringMaker(
            globals_.VIOLIN,
            pizz_maker=infit.ActivityLevel(5, start_at=0),
            tremolo_maker=infit.ActivityLevel(0),
            acciaccatura_maker=infit.ActivityLevel(5),
            force_acciaccatura_to_glissando_maker=infit.ActivityLevel(0),
            acciaccatura_glissando_size_maker=infit.Cycle((0, 1, 0)),
            harmonic_pitches_activity=0.3,
            harmonic_pitches_density=0.7,
            shall_add_optional_pitches=True,
            optional_pitches_maximum_octave_difference_from_melody_pitch=(1, 0),
            optional_pitches_min_size=F(3, 16),
            optional_pitches_density=0.75,
            after_glissando_size=F(1, 8),
        ),
        viola=strings.SimpleStringMaker(
            globals_.VIOLA,
            tremolo_maker=infit.ActivityLevel(0),
            pizz_maker=infit.ActivityLevel(5, start_at=0),
            acciaccatura_maker=infit.ActivityLevel(5),
            force_acciaccatura_to_glissando_maker=infit.ActivityLevel(0),
            acciaccatura_glissando_size_maker=infit.Cycle((0, 1, 0, 1, 0, 0, 0)),
            harmonic_pitches_activity=0.4,
            harmonic_pitches_density=0.75,
            shall_add_optional_pitches=True,
            optional_pitches_maximum_octave_difference_from_melody_pitch=(1, 0),
            optional_pitches_min_size=F(3, 16),
            optional_pitches_density=0.75,
        ),
        cello=strings.SimpleStringMaker(
            globals_.CELLO,
            tremolo_maker=infit.ActivityLevel(0),
            pizz_maker=infit.ActivityLevel(0),
            force_acciaccatura_to_glissando_maker=infit.ActivityLevel(0),
            acciaccatura_glissando_size_maker=infit.Cycle((0, 1, 0, 1, 0)),
            shall_add_optional_pitches=True,
            acciaccatura_maker=infit.ActivityLevel(5),
            harmonic_pitches_activity=0.35,
            harmonic_pitches_density=0.7,
            optional_pitches_maximum_octave_difference_from_melody_pitch=(1, 0),
            optional_pitches_min_size=F(3, 16),
            optional_pitches_density=0.7,
            after_glissando_size=F(1, 8),
        ),
        keyboard=keyboard.KeyboardMaker(
            lh_min_volume=0.68,
            lh_max_volume=0.79,
            lh_min_metricity_to_add_harmony=0,
            lh_min_metricity_to_add_accent=10,
            lh_max_metricity_for_arpeggio=0.3,
            lh_min_metricity_to_add_restricted_harmony=0,
            lh_prohibit_repetitions=False,
            lh_add_repetitions_avoiding_notes=False,
            rh_likelihood_making_harmony=1,
            harmonies_max_difference=1200,
            harmonies_min_difference=250,
            colotomic_structure=(1, 2, 2, 2),
        ),
    )

    _adapt_violin(vm.violin.musdat[1], vm)
    _adapt_viola(vm.viola.musdat[1], vm)
    _adapt_cello(vm.cello.musdat[1], vm)
    _adapt_keyboard(vm.keyboard.musdat[2], vm.keyboard.musdat[1], vm)

    # vm.add_bar(33, abjad.TimeSignature((2, 4)), force_adding=True)

    # _adapt_left_hand(vm.keyboard.musdat[2], vm)

    for string in (vm.violin.musdat[1], vm.viola.musdat[1], vm.cello.musdat[1]):
        tw.detach_hauptstimme(string)
        tw.detach_optional_events(string)

    for instr in (
        vm.violin.musdat[1],
        vm.viola.musdat[1],
        vm.cello.musdat[1],
        vm.keyboard.musdat[2],
        vm.keyboard.musdat[1],
    ):
        tw.detach_optional_events(instr)

    verse = vm()

    for instr in ("violin", "viola", "cello", "keyboard"):
        if instr == "keyboard":
            indices = ((1, 0), (1, 1))
        else:
            indices = ((1,),)

        for idx in indices:
            staff = getattr(verse, instr).abjad
            for subidx in idx:
                staff = staff[subidx]

            """
            # adapting accidental notation of keyboard
            if instr == "keyboard" and idx[1] == 1:
                abjad.Accidental.respell_with_sharps(staff[6][3:])
                abjad.Accidental.respell_with_sharps(staff[7])
                abjad.Accidental.respell_with_sharps(staff[8])
                abjad.Accidental.respell_with_sharps(staff[18])
                abjad.Accidental.respell_with_sharps(staff[19])
                abjad.Accidental.respell_with_sharps(staff[20])
            """

            if instr == "violin":
                # abjad.attach(abjad.Dynamic('ppp'), staff[0][0])
                abjad.attach(abjad.StartHairpin(), staff[2][0])
                abjad.attach(abjad.Dynamic("p"), staff[3][0])
                abjad.attach(abjad.StartHairpin(">"), staff[3][6])
                abjad.attach(abjad.Dynamic("ppp"), staff[4][2])
                abjad.attach(abjad.StartHairpin(">"), staff[6][2])
                abjad.attach(abjad.Dynamic("pppp"), staff[7][0])
                # abjad.attach(
                #     abjad.StringContactPoint("sul tasto").markup, staff[7][0],
                # )
                # abjad.attach(
                #     abjad.StringContactPoint("ordinario").markup, staff[8][0],
                # )
                # abjad.attach(
                #     abjad.StringContactPoint("sul tasto").markup, staff[9][0],
                # )
                abjad.attach(abjad.Dynamic("pp"), staff[12][2])
                abjad.attach(abjad.Fermata(), staff[16][2])
                abjad.attach(abjad.Dynamic("p"), staff[17][0])
                abjad.attach(abjad.Dynamic("pppp"), staff[17][2])
                abjad.attach(abjad.StartHairpin(), staff[18][1])
                abjad.attach(abjad.Dynamic("p"), staff[19][0])
                abjad.attach(abjad.Dynamic("pp"), staff[22][-1])
                abjad.attach(abjad.Dynamic("p"), staff[30][2])
                abjad.attach(abjad.StartHairpin(">"), staff[31][-1])
                abjad.attach(abjad.Dynamic("pppp"), staff[33][0])
                # abjad.attach(FLAUTANDO, staff[33][0])

            elif instr == "viola":
                abjad.attach(abjad.StartHairpin(), staff[2][0])
                abjad.attach(abjad.Dynamic("pp"), staff[3][0])
                abjad.attach(abjad.StartHairpin(">"), staff[3][3])
                abjad.attach(abjad.Dynamic("ppp"), staff[4][1])
                abjad.attach(abjad.Dynamic("pppp"), staff[7][0])
                # abjad.attach(
                #     abjad.StringContactPoint("sul tasto").markup, staff[8][0],
                # )
                abjad.attach(abjad.Dynamic("pp"), staff[12][2])
                abjad.attach(abjad.Fermata(), staff[16][2])
                abjad.attach(abjad.Dynamic("p"), staff[17][0])
                abjad.attach(abjad.Dynamic("pp"), staff[18][2])
                abjad.attach(abjad.StartHairpin(), staff[18][2])
                abjad.attach(abjad.Dynamic("p"), staff[19][0])
                abjad.attach(abjad.Dynamic("pp"), staff[23][0])
                abjad.attach(abjad.Dynamic("p"), staff[30][1])
                abjad.attach(abjad.StartHairpin(">"), staff[31][-1])
                abjad.attach(abjad.Dynamic("pppp"), staff[33][0])
                # abjad.attach(FLAUTANDO, staff[33][0])

            elif instr == "cello":
                abjad.attach(abjad.StartHairpin(), staff[2][0])
                abjad.attach(abjad.Dynamic("pp"), staff[3][0])
                # abjad.attach(abjad.Dynamic('pp'), staff[2][0])
                abjad.attach(abjad.StartHairpin(">"), staff[3][5])
                abjad.attach(abjad.Dynamic("ppp"), staff[4][1])
                abjad.attach(abjad.StartHairpin(">"), staff[6][1])
                abjad.attach(abjad.Dynamic("pppp"), staff[7][0])
                abjad.attach(
                    abjad.StringContactPoint("sul tasto"), staff[8][0],
                )
                abjad.attach(abjad.Dynamic("pp"), staff[12][2])
                abjad.attach(abjad.Fermata(), staff[16][2])
                abjad.attach(abjad.Dynamic("p"), staff[17][0])
                abjad.attach(abjad.Dynamic("ppp"), staff[18][0])
                abjad.attach(abjad.StartHairpin(), staff[18][0])
                abjad.attach(abjad.Dynamic("p"), staff[19][0])
                abjad.attach(abjad.Dynamic("pp"), staff[23][0])
                abjad.attach(abjad.Dynamic("ppp"), staff[24][5])
                abjad.attach(abjad.Dynamic("pp"), staff[26][0])
                abjad.attach(abjad.Dynamic("ppp"), staff[29][0])
                abjad.attach(abjad.Dynamic("pp"), staff[29][4])
                abjad.attach(abjad.Dynamic("p"), staff[30][1])
                abjad.attach(abjad.StartHairpin(">"), staff[31][4])
                abjad.attach(abjad.Dynamic("pppp"), staff[33][0])

                abjad.attach(abjad.Fermata("longfermata"), staff[-1][-1])

                abjad.detach(globals_.NONVIB_MARKUP, staff[0][0])
                abjad.detach(globals_.CON_SORDINO_MARKUP, staff[0][0])
                abjad.attach(globals_.NONVIB_MARKUP, staff[0][1])
                abjad.attach(globals_.CON_SORDINO_MARKUP, staff[0][1])

                # abjad.attach(FLAUTANDO, staff[33][0])

            elif instr == "keyboard":
                if idx[1] == 1:
                    abjad.attach(abjad.Dynamic("pp"), staff[2][0])
                    abjad.attach(abjad.Dynamic("ppp"), staff[7][0])
                    abjad.attach(abjad.Dynamic("p"), staff[11][0])
                    abjad.attach(abjad.Dynamic("pp"), staff[12][1])
                    abjad.attach(abjad.Dynamic("p"), staff[18][1])
                    abjad.attach(abjad.Dynamic("pp"), staff[26][3])
                    abjad.attach(abjad.Dynamic("ppp"), staff[27][1])
                    abjad.attach(abjad.Dynamic("pp"), staff[30][0])
                    abjad.attach(abjad.Dynamic("p"), staff[31][0])
                    abjad.attach(abjad.StartHairpin(">"), staff[32][1])
                    abjad.attach(abjad.Dynamic("ppp"), staff[33][0])

                    abjad.attach(abjad.Fermata(), staff[16][1])
                else:
                    abjad.attach(abjad.Fermata(), staff[16][1])

            abjad.attach(abjad.Dynamic("ppp"), staff[0][0])

    return verse
Exemplo n.º 11
0
def post_process_voice_one(voice_one, score):
    print("post processing voice one")
    custom_ties(voice_one)
    respell(voice_one)
    # metronome mark I
    abjad.attach(
        abjad.MetronomeMark((1, 8), (128, 144), "Andante, molto liberamente"),
        voice_one[0])
    # rehearsal mark
    markI = abjad.RehearsalMark(number=5)
    abjad.attach(markI, voice_one[0])
    scheme = abjad.Scheme("format-mark-box-alphabet")
    abjad.setting(score).markFormatter = scheme

    change_clef(voice_one)

    # numbered leaves
    selection = abjad.select(voice_one).leaves()
    for i, leaf in enumerate(selection):
        # abjad.attach(abjad.Markup(i, direction=abjad.Up), leaf)  ###################################### numerate leaves
        pass
    abjad.Accidental.respell_with_sharps(selection[22:28])
    abjad.Accidental.respell_with_flats(selection[28:32])

    del selection[70].note_heads[0]
    selection[70].note_heads.extend([0])
    abjad.mutate(selection[71]).transpose(+12)

    del selection[73].note_heads[-1]

    # ritardando mark
    rit_text_span = abjad.LilyPondLiteral(
        r'\once \override TextSpanner.bound-details.left.text = "ritardando"' +
        " " + r"\once \override TextSpanner.style = #'dashed-line")
    start_rit = abjad.LilyPondLiteral(r"\startTextSpan")
    stop_accel_text_span = abjad.StopTextSpan(command=r"\stopTextSpan")

    abjad.attach(rit_text_span, selection[40])
    abjad.attach(start_rit, selection[40])
    abjad.attach(stop_accel_text_span, selection[44])
    abjad.attach(rit_text_span, selection[72])
    abjad.attach(start_rit, selection[72])
    abjad.attach(stop_accel_text_span, selection[75])

    abjad.override(voice_one).tuplet_bracket.direction = abjad.Up

    # tempos
    lento = abjad.MetronomeMark((1, 8), (64, 72), "Lento")
    quasi_statico = abjad.MetronomeMark((1, 8), (32, 36), "Quasi Statico")
    # metronome mark I
    # abjad.attach(lento, voice_one[0])
    # metronome mark II
    abjad.attach(abjad.MetronomeMark(None, None, "più mosso"), selection[13])
    # metronome mark III
    abjad.attach(lento, selection[45])
    abjad.attach(quasi_statico, selection[76])

    del voice_one[-4:]
    abjad.attach(abjad.Tie(), selection[89])
    voice_one.append('<gs, a, b,>2.')
    voice_one.append('r2.')
    abjad.attach(abjad.Fermata(), voice_one[-1])

    return voice_one
Exemplo n.º 12
0
def post_process_voice_one(voice_one, score):
    # delete something
    del voice_one[-5:]
    #
    # # change last note duration
    # voice_one[-3].written_duration = (1, 2)
    # voice_one[-1].written_duration = (3, 4)
    # abjad.mutate(voice_one[-2:-1]).split([(1, 4)], cyclic=True)
    # voice_one.append("g4")
    # abjad.attach(abjad.Tie(), voice_one[-2])
    insert_chord = abjad.Chord("g' c'' e''", (3, 4))
    voice_one.insert(-2, insert_chord)

    voice_one[-1].written_duration = (3, 8)
    # voice_one.append(final_chord)
    abjad.attach(abjad.Tie(), voice_one[-3])

    # registers
    abjad.attach(
        abjad.LilyPondLiteral(
            r"\override TextScript.outside-staff-priority = #'1100"),
        voice_one[0])
    register_one = abjad.Markup(r"""\scale #'(0.5 . 0.5)
          \column{

            \line{
          \draw-circle #1.1 #0.3 ##f
          \draw-circle #1.1 #0.3 ##f
            }
           \line{
          \draw-circle #1.1 #0.3 ##t
          \draw-circle #1.1 #0.3 ##t
            }
           \line{
          \draw-circle #1.1 #0.3 ##f
          \draw-circle #1.1 #0.3 ##f
            }
           \line{
          \draw-circle #1.1 #0.3 ##f
          \draw-circle #1.1 #0.3 ##f
            }
          }""",
                                direction=abjad.Up)
    abjad.attach(register_one, voice_one[0])

    # metronome mark I
    abjad.attach(abjad.MetronomeMark(None, None, "Statico"), voice_one[0])
    # metronome mark II
    abjad.attach(abjad.MetronomeMark((1, 8), (32, 36), "Quasi Statico"),
                 voice_one[1])
    # text script (timbres) priority
    # priority = abjad.LilyPondLiteral(
    #     r"\once \override Staff.TextScript.outside-staff-priority = #1100" +
    #     " " + r"\once \override Staff.TextScript.padding = #12")
    # abjad.attach(priority, voice_one[0])

    # markup = abjad.Markup(r"Rohrflöte 4'")
    # markup = markup.box()
    # markup = markup.override(("box-padding", 0.5))
    # abjad.tweak(markup).padding = 20
    # mark = abjad.RehearsalMark(markup=markup)
    # abjad.attach(mark, voice_one[0])

    # accelerando mark
    accel_text_span = abjad.LilyPondLiteral(
        r'\once \override TextSpanner.bound-details.left.text = "accelerando poco a poco"'
        + " " + r"\once \override TextSpanner.style = #'dashed-line")
    start_accel = abjad.LilyPondLiteral(r"\startTextSpan")
    abjad.attach(accel_text_span, voice_one[4])
    abjad.attach(start_accel, voice_one[4])
    stop_accel_text_span = abjad.StopTextSpan(command=r"\stopTextSpan")
    abjad.attach(stop_accel_text_span, voice_one[9])

    # metronome mark III
    abjad.attach(abjad.MetronomeMark((1, 8), (64, 72), "Lento"), voice_one[10])

    # ritardando mark
    rit_text_span = abjad.LilyPondLiteral(
        r'\once \override TextSpanner.bound-details.left.text = "ritardando poco a poco"'
        + " " + r"\once \override TextSpanner.style = #'dashed-line")
    start_rit = abjad.LilyPondLiteral(r"\startTextSpan")
    abjad.attach(rit_text_span, voice_one[14])
    abjad.attach(start_rit, voice_one[14])
    stop_accel_text_span = abjad.StopTextSpan(command=r"\stopTextSpan")
    abjad.attach(stop_accel_text_span, voice_one[-3])

    # metronome mark IV
    abjad.attach(abjad.MetronomeMark((1, 8), (32, 36), "Quasi Statico"),
                 voice_one[-2])

    # fermata
    abjad.attach(abjad.Fermata(), voice_one[-1])

    # REGISTER TRANSPOSITION
    abjad.mutate(voice_one).transpose(-12)
    return voice_one