Esempio n. 1
0
def _adapt_right2(right: lily.NOventLine, vm) -> None:
    tw.swap_duration(12, 13, F(1, 16), right)

    right[21].pitch = [ji.r(96, 35), ji.r(16, 5)]
    tw.eat(21, 22, right)
    tw.rest(22, right)
    tw.shorten(21, F(1, 32), right)

    tw.crop(20, right, F(1, 4), F(1, 16) + F(1, 4))
    right[20].pitch.append(ji.r(192, 245))

    right[24].pitch.append(ji.r(8, 5))
    tw.postpone(24, F(1, 8), right)

    tw.prolong(28, F(1, 4), right)
    tw.eat(28, 29, right)

    tw.rest_many((32, 33), right)

    right[30].pitch = [ji.r(48, 49), ji.r(288, 245)]

    tw.crop(31, right, F(1, 2))
    right[31].pitch = [ji.r(48, 49), ji.r(8, 7)]

    tw.eat(30, 29, right)

    tw.swap_duration(28, 29, F(1, 8), right)

    right[31].pitch = [ji.r(35, 16), ji.r(35, 12), ji.r(7, 3)]
    right[32].pitch = [ji.r(48, 49), ji.r(8, 7)]

    # tw.shorten(31, F(1, 16), right)
    tw.crop(32, right, F(1, 4))
    right[33].pitch = [ji.r(6, 7), ji.r(8, 7)]

    [tw.eat(35, 36, right) for _ in range(9)]
    right[35].pitch.extend([ji.r(7, 4), ji.r(35, 12)])

    print("right", len(right))

    tw.shorten(35, F(1, 1), right)
    tw.crop(36, right, F(1, 8), F(1, 8), F(1, 8), F(1, 8), F(1, 8), F(1, 8), F(1, 4))
    right[36].pitch = [ji.r(7, 3), ji.r(35, 12)]
    right[37].pitch = [ji.r(14, 9), ji.r(2, 1)]
    right[38].pitch = [ji.r(2, 1)]
    right[39].pitch = [ji.r(14, 9), ji.r(2, 1)]
    right[40].pitch = [ji.r(16, 15)]
    right[41].pitch = [ji.r(7, 4), ji.r(14, 9)]
    right[42].pitch = [ji.r(7, 3), ji.r(35, 12)]

    tw.shorten(35, F(1, 4), right)
Esempio n. 2
0
def _adapt_left2(left: lily.NOventLine, vm) -> None:
    tw.rest_many((25, 26), left)
    tw.add_gong(25, left, ji.r(16, 15))
    tw.rest(26, left)
    left[28].pitch.append(ji.r(1, 1))
    tw.prolong(28, F(2, 4), left)
    tw.postpone(27, F(1, 16), left)
    tw.shorten(25, F(1, 4), left)
    left[26].ottava = attachments.Ottava(0)
    left[26].pedal = attachments.Pedal(False)

    left[32].pitch = [ji.r(24, 49), ji.r(144, 245)]

    tw.add_kenong(34, left, ji.r(8, 7))
    tw.add_kenong(35, left, ji.r(1, 1))
    tw.add_kenong(36, left, ji.r(7, 6))

    left[34].arpeggio = None

    left[31].ottava = attachments.Ottava(0)
    left[31].pedal = attachments.Pedal(False)
    tw.crop(31, left, *([F(1, 16)] * 4))
    left[31].pitch = [ji.r(18, 49)]
    left[32].pitch = [ji.r(96, 245)]
    left[33].pitch = [ji.r(24, 49)]
    left[34].pitch = [ji.r(128, 245)]

    tw.eat(32, 31, left)

    left[40].pitch = [ji.r(3, 4), ji.r(4, 7)]
    tw.crop(41, left, F(1, 16))
    left[41].pitch = [ji.r(7, 9)]
    left[42].pitch = [ji.r(7, 8), ji.r(7, 6)]
    left[43].pitch = [ji.r(4, 3), ji.r(7, 9)]
    # left[43].arpeggio = None

    left[46].pitch = [ji.r(7, 18), ji.r(7, 24)]

    print("left", len(left))

    tw.eat(46, 47, left)
    tw.make_solo_gong(47, left)
    tw.add_kenong(48, left, ji.r(1, 1))
    tw.add_kenong(49, left, ji.r(16, 15))

    left[48].pitch = [ji.r(1, 4)]
    left[48].volume = 0.81
    left[49].pitch = [ji.r(4, 15)]
    left[49].volume = 0.83
Esempio n. 3
0
def _adapt_right_hand(right: lily.NOventLine, vm) -> None:
    tw.swap_duration(0, 1, F(5, 16), right)
    tw.split_by_structure(17, 4, right, vm, adapt_by_changed_structure=True)
    tw.rest(19, right)
    tw.split(22, right, F(1, 8), F(3, 16))
    right[23].pitch = right[21].pitch
    right[29].optional_some_pitches = None
    right[49].optional_some_pitches = None

    tw.postpone(1, F(1, 4) + F(1, 16), right)
    tw.prolong(1, F(1, 8), right)
    tw.prolong(3, F(1, 8), right)

    right[2].pitch = [ji.r(3, 2), ji.r(2, 1)]
    right[4].pitch = [ji.r(7, 12), ji.r(35, 64)]
    right[5].pitch = [ji.r(7, 3), ji.r(14, 9), ji.r(35, 24)]
    right[6].pitch = [ji.r(7, 9), ji.r(7, 12), ji.r(1, 2)]
    right[7].pitch = [ji.r(7, 3), ji.r(35, 12), ji.r(35, 16)]
    tw.crop(7, right, F(1, 4))
    right[8].pitch = [ji.r(7, 4), ji.r(7, 3), ji.r(2, 1)]
    right[9].pitch = [ji.r(7, 3), ji.r(14, 9), ji.r(35, 24)]
    right[10].pitch = [ji.r(7, 12), ji.r(35, 64)]
    tw.prolong(10, F(1, 8), right)
    right[11].pitch = [ji.r(14, 9), ji.r(7, 3), ji.r(2, 1)]

    for n in range(4, 12):
        right[n].volume = 0.67

    right[13].pitch = [ji.r(64, 63), ji.r(256, 189)]
    tw.prolong(14, F(1, 8), right)
    right[14].pitch = [ji.r(7, 3), ji.r(35, 16), ji.r(35, 12)]
    right[15].pitch = [ji.r(7, 4), ji.r(2, 1), ji.r(7, 3)]
    right[16].pitch = [ji.r(288, 245), ji.r(48, 49)]
    tw.eat(16, 17, right)
    right[17].pitch = [ji.r(192, 245), ji.r(256, 245)]
    tw.eat(17, 18, right)
    right[18].pitch = [ji.r(64, 63), ji.r(256, 189)]
    tw.eat(18, 19, right)
    right[19].pitch = [ji.r(36, 49)]
    right[20].pitch = [ji.r(256, 245)]
Esempio n. 4
0
def _adapt_cello2(cello: lily.NOventLine, vm) -> None:
    tw.crop(12, cello, F(2, 8), F(1, 16), F(3, 16))
    cello[12].pitch = [ji.r(1, 2)]
    tw.set_pizz(12, cello)

    cello[14].pitch = [ji.r(7, 12)]
    tw.set_arco(14, cello)

    cello[21].glissando = None
    cello[21].pitch = [ji.r(256, 189).register(-1)]

    tw.swap_duration(20, 21, F(1, 16), cello)
    tw.set_arco(24, cello)
    tw.crop(24, cello, F(2, 8) + F(1, 16), F(1, 16), F(1, 8))
    tw.change_octave(24, -1, cello)
    cello[26].acciaccatura = None
    tw.set_pizz(26, cello)
    tw.rest(25, cello)

    tw.prolong(28, F(1, 32), cello)
    tw.crop(29, cello, F(3, 4), F(1, 8))
    cello[30].pitch = [ji.r(1, 1)]
    cello[30].natural_harmonic = attachments.NaturalHarmonic()
    tw.set_pizz(30, cello)

    tw.crop(31, cello, F(3, 8), F(1, 8) + F(3, 4))
    cello[32].pitch = [ji.r(72, 49)]
    tw.set_arco(32, cello)
    tw.add_artifical_harmonic(32, ji.r(72, 49).register(-2), cello)
    # cello[32].ornamentation = attachments.OrnamentationUp(2)

    # tw.postpone(33, F(1, 8), cello)
    # cello[34].glissando = None
    tw.rest(33, cello)
    tw.rest(34, cello)
    tw.crop(33, cello, F(1, 16), F(1, 16), F(1, 16), F(1, 16), F(1, 4))
    cello[34].pitch = [ji.r(1, 2)]
    cello[35].pitch = [ji.r(7, 12)]
    cello[36].pitch = [ji.r(7, 12)]
    cello[37].pitch = [ji.r(7, 24)]
    for n in range(34, 38):
        tw.set_pizz(n, cello)

    cello[38].pitch = [ji.r(72, 49).register(-2)]
    tw.set_arco(38, cello)

    for n in range(38, 40):
        tw.change_octave(n, 1, cello)

    tw.rest_many((41, 42, 44), cello)

    cello[46].pitch = [ji.r(7, 12)]
    tw.set_arco(46, cello)
    tw.swap_duration(45, 46, F(1, 8), cello)
    tw.shorten(46, F(2, 4) + F(1, 8), cello)

    tw.change_octave(42, 1, cello)
    tw.shorten(42, F(1, 4), cello)
    tw.set_arco(42, cello)

    print("len(cello)", len(cello))

    tw.rest_many((46, 45, 44), cello)
    tw.crop(
        43, cello, F(1, 8), F(3, 8), F(3, 16), F(1, 16), F(3, 16), F(1, 16), F(3, 8)
    )
    cello[44].pitch = [ji.r(7, 12)]
    cello[45].pitch = [ji.r(1, 2)]
    cello[46].pitch = [ji.r(7, 12)]
    cello[47].pitch = [ji.r(8, 15)]
    cello[49].pitch = [ji.r(7, 12)]

    tw.split(44, cello, F(1, 4), F(1, 8))

    for n in (44, 45, 46, 47, 48, 50):
        tw.set_pizz(n, cello)

    tw.set_arco(44, cello)
    tw.shorten(44, F(1, 16), cello)
    tw.add_glissando(44, (-1, 0, 0), cello, durations=[F(1, 8), F(1, 16)])
Esempio n. 5
0
def _adapt_viola2(viola: lily.NOventLine, vm) -> None:
    tw.prolong(19, F(1, 32), viola)
    tw.crop(19, viola, F(1, 16), F(1, 16), F(1, 16), position=False)
    viola[21].pitch = [ji.r(8, 7)]
    viola[22].pitch = [ji.r(4, 3)]
    viola[23].pitch = [ji.r(8, 7)]

    for n in (20, 21, 22, 23):
        tw.set_pizz(n, viola)
        tw.change_octave(n, -1, viola)

    tw.rest_many((26, 27), viola)
    tw.prolong(24, F(1, 32), viola)
    tw.crop(25, viola, F(1, 8), F(2, 8) + F(1, 16), F(1, 16), F(1, 8))
    viola[26].pitch = [ji.r(4, 5)]
    tw.set_arco(26, viola)
    viola[28].pitch = [ji.r(2, 3)]
    tw.set_pizz(28, viola)
    tw.rest(27, viola)

    tw.set_pizz(33, viola)
    tw.change_octave(33, 1, viola)
    tw.prolong(33, F(5, 32), viola)
    tw.postpone(33, F(1, 8), viola)

    # print(viola[33:36])

    tw.crop(34, viola, F(1, 4) + F(1, 16), F(2, 16), F(1, 16))
    viola[35].pitch = [ji.r(48, 49)]
    viola[36].pitch = [ji.r(256, 245)]

    viola[37].pitch = [ji.r(48, 49)]
    viola[37].acciaccatura = None

    viola[38].pitch = [ji.r(256, 245)]
    tw.crop(38, viola, F(1, 16))
    viola[39].pitch = [ji.r(8, 7)]
    viola[40].acciaccatura = None
    tw.swap_duration(40, 39, F(1, 8), viola)

    tw.crop(41, viola, F(1, 8), F(1, 4))
    viola[41].pitch = [ji.r(7, 8)]
    viola[42].pitch = [ji.r(35, 48)]

    for n in (35, 36, 39, 41, 42):
        tw.set_arco(n, viola)

    viola[43].ornamentation = None
    tw.crop(43, viola, F(1, 8))
    viola[43].pitch = [ji.r(48, 49)]

    tw.shorten(42, F(1, 16), viola)
    viola[47].pitch = [ji.r(2, 3)]
    # tw.shorten(47, F(1, 32), viola)
    viola[48].pitch = [ji.r(35, 48)]
    tw.set_arco(46, viola)
    tw.set_arco(48, viola)
    tw.prolong(55, F(1, 32), viola)
    # tw.crop(55, viola, F(1, 16))
    viola[54].pitch = [ji.r(35, 48)]

    tw.split_by_structure(48, 2, viola, vm, adapt_by_changed_structure=True)
    viola[49].pitch = [ji.r(2, 3)]
    tw.set_pizz(49, viola)

    tw.rest_many((56, 55, 53, 52), viola)
    tw.crop(
        51,
        viola,
        F(1, 8),
        F(1, 4),
        F(1, 8),
        F(1, 8),
        F(1, 8),
        F(3, 16),
        F(1, 16),
        F(1, 8),
        F(1, 8),
        F(1, 8),
        F(1, 8),
        F(1, 8),
        F(1, 8),
    )
    viola[52].pitch = [ji.r(35, 48)]
    viola[54].pitch = [ji.r(2, 3)]
    viola[56].pitch = [ji.r(2, 3)]
    viola[57].pitch = [ji.r(7, 8)]
    viola[58].pitch = [ji.r(35, 48)]

    for n in range(59, 64):
        viola[n].pitch = [ji.r(7, 8)]

    for n in (51, 53, 55, 56, 57, 58, 59, 60, 61, 62):
        if n == 51:
            tw.set_arco(n + 1, viola)
        else:
            tw.set_pizz(n + 1, viola)

    for idx, value in enumerate(np.linspace(1.1, 0.2, 5)):
        viola[59 + idx].volume = float(value)

    tw.shorten(52, F(1, 16), viola)
    tw.add_glissando(52, (1, 0, 0), viola, durations=[F(1, 8), F(1, 16)])
Esempio n. 6
0
def _adapt_violin2(violin: lily.NOventLine, vm) -> None:
    tw.crop(15, violin, F(1, 4), F(1, 8), F(1, 8))
    violin[15].pitch = [ji.r(3, 4)]
    tw.set_pizz(15, violin)

    violin[16].pitch = [ji.r(7, 9)]
    tw.set_arco(16, violin)
    violin[17].pitch = [ji.r(8, 9)]
    tw.set_arco(17, violin)

    tw.split_by_structure(23, 2, violin, vm, adapt_by_changed_structure=True)
    violin[24].acciaccatura = None
    violin[24].pitch = [ji.r(8, 9)]
    tw.set_pizz(24, violin)
    tw.crop(24, violin, F(1, 8))
    violin[25].pitch = [ji.r(7, 9)]
    tw.prolong(25, F(1, 16), violin)

    violin[26].pitch = [ji.r(288, 245)]
    tw.set_pizz(26, violin)
    violin[27].pitch = [ji.r(48, 35)]
    tw.set_pizz(27, violin)
    tw.crop(28, violin, F(1, 8), F(1, 8), F(2, 4))
    violin[28].pitch = [ji.r(288, 245)]
    tw.set_pizz(28, violin)
    violin[29].pitch = [ji.r(288, 245)]
    tw.set_arco(29, violin)
    tw.set_arco(30, violin)
    violin[30].pitch = [ji.r(48, 35)]
    tw.crop(30, violin, F(2, 8) + F(1, 16), F(1, 16), F(1, 8))
    violin[32].pitch = [ji.r(8, 9)]
    tw.set_pizz(32, violin)
    tw.rest(31, violin)

    """
    # tw.postpone(40, F(1, 4), violin)
    violin[38].ornamentation = None
    # tw.change_octave(38, 1, violin)
    tw.crop(38, violin, F(3, 8), F(1, 4))
    tw.rest(39, violin)
    tw.crop(39, violin, F(1, 4), F(1, 8), F(1, 8))
    violin[40].pitch = [ji.r(8, 9)]
    violin[41].pitch = [ji.r(7, 9)]
    tw.set_arco(40, violin)
    tw.set_arco(41, violin)

    tw.crop(42, violin, F(2, 8))
    violin[43].pitch = [ji.r(3, 4)]

    tw.crop(44, violin, F(1, 4))
    violin[44].pitch = [ji.r(64, 63)]
    tw.set_arco(44, violin)

    tw.crop(39, violin, F(1, 8))
    violin[40].pitch = [ji.r(64, 63)]
    tw.set_arco(40, violin)

    tw.crop(38, violin, F(1, 8), F(1, 8), F(1, 8))
    tw.rest(39, violin)

    tw.crop(37, violin, F(1, 4))
    violin[38].pitch = [ji.r(48, 35)]
    tw.set_arco(38, violin)
    violin[38].volume = 0.3

    tw.swap_duration(44, 43, F(1, 16), violin)
    tw.postpone(43, F(1, 16), violin)

    tw.crop(47, violin, F(1, 16))
    violin[48].pitch = [ji.r(8, 9)]
    """

    tw.shorten(38, F(3, 16), violin)
    violin[38].ornamentation = attachments.OrnamentationDown(2)

    # for n in range(41, 45):
    #     # tw.set_pizz(n, violin)
    #     tw.change_octave(n, 1, violin)

    tw.shorten(40, F(1, 16), violin)

    violin[42].acciaccatura = None
    tw.change_octave(42, -1, violin)
    tw.swap_duration(41, 42, F(1, 8), violin)
    tw.prolong(42, F(1, 4), violin)
    tw.crop(42, violin, F(3, 16), F(3, 16), F(1, 8))
    violin[43].pitch = [ji.r(7, 9)]
    violin[44].pitch = [ji.r(8, 9)]
    violin[46].pitch = [ji.r(7, 9)]
    tw.set_arco(46, violin)
    tw.prolong(46, F(1, 8), violin)
    violin[46].volume = 0.3
    tw.crop(46, violin, F(2, 16))
    violin[47].pitch = [ji.r(8, 9)]

    tw.set_pizz(47, violin)
    tw.set_pizz(46, violin)

    print("len(violin)", len(violin))

    tw.rest_many((52,), violin)
    tw.crop(51, violin, F(1, 8), F(3, 16), F(1, 16), F(3, 16), F(1, 16), F(3, 4))
    violin[51].pitch = [ji.r(7, 9)]
    violin[52].pitch = [ji.r(8, 9)]
    violin[53].pitch = [ji.r(7, 9)]
    violin[54].pitch = [ji.r(8, 9)]
    violin[55].pitch = [ji.r(35, 32)]
    violin[56].pitch = [ji.r(35, 32)]

    for n in range(51, 57):
        tw.set_pizz(n, violin)

    tw.shorten(50, F(1, 16), violin)
    tw.add_glissando(50, (1, 0, 0), violin, durations=[F(1, 8), F(1, 16)])

    tw.crop(39, violin, F(1, 16) + F(1, 4), F(1, 8))
    violin[40].pitch = [ji.r(48, 35)]
    tw.set_pizz(40, violin)
Esempio n. 7
0
def _adapt_cello(cello: lily.NOventLine, vm) -> None:
    tw.detach_optional_events(cello)

    cello[1].natural_harmonic = attachments.NaturalHarmonic()
    tw.change_octave(3, 1, cello, change_main_pitches=False)
    tw.change_octave(3, -2, cello, change_acciaccatura_pitches=False)
    cello[4].string_contact_point = attachments.StringContactPoint("pizzicato")
    cello[4].volume = 1
    tw.change_octave(4, 1, cello, change_main_pitches=False)
    tw.change_octave(5, -2, cello, change_acciaccatura_pitches=False)
    tw.change_octave(6, -2, cello, change_acciaccatura_pitches=False)

    cello[9].volume = 0.6
    cello[9].string_contact_point = attachments.StringContactPoint("arco")

    for n in (9, 11, 13):
        cello[n].artifical_harmonic = None
        tw.change_octave(n, -1, cello, change_acciaccatura_pitches=False)

    cello[13].glissando = None

    tw.swap_duration(10, 9, F(5, 32), cello)
    tw.swap_duration(11, 10, F(1, 16), cello)
    tw.add_glissando(
        9, (0, 0, -1), cello, durations=[F(4, 16), F(3, 32)],
    )
    tw.add_glissando(
        10, (0, 0, 1), cello, durations=[F(1, 32) + F(1, 8) + F(3, 16), F(1, 16)],
    )

    cello[14].hauptstimme = attachments.Hauptstimme(False, False)
    tw.rest(16, cello)
    tw.change_octave(16, 1, cello)
    tw.add_glissando(
        16, (0, 0, -2), cello, durations=[F(3, 16), F(1, 16)],
    )

    for n in (19, 20):
        cello[n].artifical_harmonic = None
        cello[n].acciaccatura = None
        cello[n].glissando = None
        cello[n].volume = 0.3
        tw.change_octave(n, -2, cello)

    tw.split(
        21, cello, F(7, 4) + F(1, 8), F(5, 8) + F(2, 4),
    )
    cello[21].pitch = [ji.r(7, 24)]
    cello[21].string_contact_point = attachments.StringContactPoint("pizzicato")
    cello[21].volume = 1.87
    tw.split_by_structure(21, 6, cello, vm, adapt_by_changed_structure=True)

    for n in range(21, 21 + 6):
        if n % 3 == 0:
            cello[n].pitch = [ji.r(1, 4)]

    cello[21].pitch = [ji.r(8, 15)]
    cello[22].pitch = [ji.r(1, 2)]
    for n in (21, 22, 23):
        cello[n].string_contact_point = attachments.StringContactPoint("arco")
        cello[n].volume = 0.3

    cello[23].volume = 0.6
    tw.add_acciaccatura(19, ji.r(256, 189).register(-2), cello, add_glissando=True)
    tw.add_glissando(
        21, (0, -1), cello, durations=[F(3, 16)],
    )
    tw.add_glissando(
        22, (0, 0, -1), cello, durations=[F(3, 16), F(1, 8)],
    )

    cello[6].pitch = [ji.r(7, 12)]
    cello[6].acciaccatura = None
    tw.set_arco(6, cello)

    tw.shorten(7, F(3, 32), cello)
    tw.crop(8, cello, F(3, 4), F(2, 4), F(2, 16), F(2, 16))
    cello[9].pitch = [ji.r(7, 12)]
    tw.set_pizz(9, cello)
    cello[11].pitch = [ji.r(7, 12)]
    tw.set_pizz(11, cello)

    tw.shorten(1, F(3, 32), cello)
    cello[2].pitch = [ji.r(16, 15)]
    tw.set_pizz(2, cello)

    # tw.crop(
    #  12, cello, F(1, 8), F(1, 8), F(1, 8), F(1, 8), F(1, 8), F(1, 8), F(1, 8), F(1, 8))
    tw.crop(12, cello, F(5, 4))
    cello[12].pitch = [ji.r(256, 189).register(-1)]
    tw.split_by_structure(12, 6, cello, vm, adapt_by_changed_structure=True)
    cello[13].pitch = [ji.r(7, 6).register(-1)]
    cello[14].pitch = [ji.r(1, 1).register(-1)]
    cello[15].pitch = [ji.r(7, 6).register(-1)]
    cello[16].pitch = [ji.r(72, 49).register(-1)]
    cello[17].pitch = [ji.r(384, 245).register(-1)]
    # cello[18].pitch = [ji.r(72, 49).register(-1)]

    # for n in (13, 15, 17, 19):
    for n in range(12, 19):
        cello[n].glissando = None
        cello[n].acciaccatura = None
        # tw.set_pizz(n, cello)
        # cello[n].volume = 0.6
        tw.set_arco(n, cello)
        cello[n].volume = 0.3

    # tw.set_arco(12, cello)
    # cello[12].volume = 0.3
    # tw.postpone(12, F(1, 8), cello)

    tw.add_glissando(12, (0, 0, -1), cello, durations=[F(1, 8), F(1, 8)])
Esempio n. 8
0
def _adapt_violin(violin: lily.NOventLine, vm) -> None:
    tw.detach_optional_events(violin)

    violin[13].acciaccatura = None
    violin[12].acciaccatura = None
    tw.add_glissando(
        12, (0, 0, 1), violin, verse_maker=vm, adapt_by_changed_structure=True
    )
    tw.prolong(14, F(3, 8), violin)
    tw.split(
        13, violin, F(1, 4), F(1, 8), F(1, 8),
    )
    # tw.rest(14, violin)
    # violin[14].string_contact_point = attachments.StringContactPoint('pizzicato')
    # violin[14].volume = 2
    tw.add_glissando(
        15, (0, 1), violin, verse_maker=vm, adapt_by_changed_structure=True
    )
    violin[16].ornamentation = attachments.OrnamentationUp(2)

    tw.prolong(1, F(1, 8), violin)
    tw.change_octave(1, -1, violin)
    violin[1].acciaccatura = None
    for n in (2, 6, 8):
        violin[n].acciaccatura = None
        tw.add_glissando(
            n, (1, 0, 0, 0), violin, verse_maker=vm, adapt_by_changed_structure=True
        )

    tw.add_glissando(
        2, (-1, 0, 0, -1), violin, verse_maker=vm, adapt_by_changed_structure=True
    )
    tw.add_glissando(
        8, (1, 0, 0, -1), violin, verse_maker=vm, adapt_by_changed_structure=True
    )
    violin[4].string_contact_point = attachments.StringContactPoint("arco")
    tw.split(9, violin, F(1, 16), F(1, 16))
    tw.rest(9, violin)
    tw.prolong(10, F(3, 16), violin)
    tw.swap_duration(10, 9, F(1, 16), violin)
    violin[10].volume = 2.4
    tw.add_acciaccatura(17, ji.r(35, 32), violin, add_glissando=True)

    violin[25].ornamentation = attachments.OrnamentationDown(3)

    violin[36].acciaccatura = None
    tw.add_glissando(
        38, (2, 0, 0, -1), violin, verse_maker=vm, adapt_by_changed_structure=True
    )
    violin[32].volume = 1.6
    violin[34].string_contact_point = attachments.StringContactPoint("arco")
    violin[34].volume = 0.69
    tw.swap_duration(36, 35, F(1, 8), violin)
    tw.prolong(34, F(1, 8), violin)
    tw.add_glissando(
        34, (0, 0, -1), violin, durations=[F(3, 16), F(1, 16)],
    )
    tw.add_glissando(
        36, (1, 0, 0), violin, durations=[F(1, 8), F(1, 8)],
    )

    tw.crop(0, violin, F(2, 4) + F(1, 8))
    violin[1].pitch = [ji.r(48, 35)]
    tw.set_pizz(1, violin)

    violin[6].pitch = [ji.r(7, 9)]
    tw.set_pizz(6, violin)

    # tw.crop(8, violin, F(1, 16))
    # violin[8].pitch = [ji.r(8, 9)]
    violin[10].pitch = [ji.r(7, 9)]
    tw.set_pizz(10, violin)

    tw.shorten(11, F(1, 16), violin)
    tw.crop(12, violin, F(2, 16), F(1, 16), F(1, 16))
    violin[13].pitch = [ji.r(8, 9)]
    violin[14].pitch = [ji.r(7, 9)]
    tw.set_pizz(13, violin)
    tw.set_pizz(14, violin)
Esempio n. 9
0
def _adapt_viola(viola: lily.NOventLine, vm) -> None:
    tw.detach_optional_events(viola)

    tw.swap_duration(0, 1, F(1, 16), viola)
    tw.add_glissando(
        1, (-1, 0, 0), viola, durations=(F(1, 16), F(3, 16)),
    )
    viola[2].choose = None
    viola[2].volume = 0.5
    viola[2].pitch = viola[2].pitch[:1]
    tw.prolong(2, F(1, 32), viola)
    viola[5].pitch = [ji.r(7, 8)]
    for n in (5, 6):
        viola[n].string_contact_point = attachments.StringContactPoint("arco")
        viola[n].volume = 0.5

    # tw.change_octave(12, -1, viola)
    viola[12].pitch = [ji.r(48, 49)]
    # tw.swap_duration(11, 12, F(1, 8), viola)
    tw.prolong(12, F(5, 32), viola)
    tw.add_glissando(
        12, (-1, 0, 0), viola, durations=[F(1, 8), F(1, 4)],
    )
    # tw.split(11, viola, F(1, 8), F(1, 16))
    viola[11].pitch = [ji.r(7, 8)]
    viola[11].volume = 0.5
    viola[11].string_contact_point = attachments.StringContactPoint("arco")

    tw.change_octave(14, 1, viola)

    for n in (18, 19, 21, 22, 24):
        tw.change_octave(n, -1, viola)
        viola[n].string_contact_point = attachments.StringContactPoint("pizzicato")
        viola[n].volume = 1

    viola[25].string_contact_point = attachments.StringContactPoint("arco")
    viola[25].volume = 0.5
    tw.change_octave(25, -1, viola)

    tw.rest(24, viola)

    for n in (29, 30, 33, 35, 36, 38, 39):
        tw.change_octave(n, -1, viola)

    viola[39].string_contact_point = attachments.StringContactPoint("arco")
    viola[39].volume = 0.6

    tw.rest(31, viola)

    viola[32].acciaccatura = None
    tw.prolong(32, F(1, 32), viola)
    tw.add_glissando(
        32, (0, 0, -1), viola, durations=[F(3, 16), F(1, 16)],
    )

    viola[28].ornamentation = attachments.OrnamentationUp(2)

    tw.crop(3, viola, F(1, 4) + F(3, 16), F(1, 16), F(1, 4), F(1, 4))
    viola[4].pitch = [ji.r(35, 48)]
    viola[5].pitch = [ji.r(35, 48)]
    viola[6].pitch = [ji.r(7, 8)]
    tw.set_pizz(4, viola)
    tw.set_pizz(5, viola)
    tw.set_pizz(6, viola)
    viola[6].volume = 1.5

    tw.rest(12, viola)
    tw.prolong(10, F(1, 32), viola)
    tw.crop(11, viola, F(1, 8) + F(1, 16), F(1, 16), F(1, 8))
    viola[12].pitch = [ji.r(7, 8)]
    tw.set_pizz(12, viola)
    viola[13].pitch = [ji.r(2, 3)]
    tw.set_pizz(13, viola)

    tw.postpone(14, F(1, 8), viola)
Esempio n. 10
0
def _adapt_keyboard(left: lily.NOventLine, right: lily.NOventLine, vm) -> None:
    tw.swap_duration(0, 1, F(7, 32), right)
    tw.prolong(1, F(2, 8), right)
    # right[2].pitch = [ji.r(256, 245)]
    tw.swap_duration(7, 8, F(1, 16), right)
    tw.prolong(8, F(1, 8), right)
    tw.rest_many((14, 15, 17), right)
    tw.prolong(12, F(3, 4), right)
    tw.crop(13, right, F(3, 4), F(2, 4))
    # tw.change_octave(12, -1, right)
    right[13].pitch = [ji.r(3, 4)]
    right[14].pitch = [ji.r(72, 49).register(-1)]

    tw.swap_duration(17, 18, F(2, 4), right)
    tw.swap_duration(20, 21, F(1, 16), right)
    tw.rest(28, right)

    right[26].optional_some_pitches = None
    tw.prolong(26, F(2, 4) + F(1, 16), right)

    tw.rest(28, right)

    tw.swap_duration(32, 31, F(1, 16), right)

    tw.rest(32, right)
    tw.swap_duration(31, 32, F(1, 8), right)

    tw.prolong(28, F(1, 32), right)
    right[28].optional_some_pitches = None

    for n in (38, 39, 40, 42):
        right[n].optional_some_pitches = None

    tw.swap_duration(45, 44, F(1, 32), right)

    for n in (46,):
        right[n].optional_some_pitches = None

    # tw.swap_duration(48, 49, F(1, 4), right)
    tw.rest(49, right)
    right[49].pitch = [ji.r(16, 5)]
    right[50].pitch.append(ji.r(1, 2))

    right[51].pitch = [ji.r(7, 3), ji.r(7, 4), ji.r(35, 12)]
    right[51].optional_some_pitches = None

    tw.change_octave(52, 1, right)
    right[52].pitch.append(ji.r(48, 35).register(1))
    tw.shorten(55, F(7, 16), right)

    tw.crop(45, right, F(1, 2), position=False)
    right[46].pitch = [ji.r(35, 24)]
    tw.crop(46, right, F(3, 8))
    tw.rest(47, right)

    tw.rest_many((59, 60, 61, 63), right)

    tw.crop(
        58,
        right,
        F(2, 4),
        F(2, 4),
        F(2, 4),
        F(2, 4),
        F(4, 4),
        F(1, 4),
        F(3, 4),
        F(4, 4),
    )
    right[58].pitch = [ji.r(48, 49).register(-1)]
    right[59].pitch = [ji.r(384, 245).register(-1)]
    right[60].pitch = [ji.r(8, 5)]
    right[61].pitch = [ji.r(256, 245)]
    right[62].pitch = [ji.r(48, 49).register(-1)]
    right[63].pitch = [ji.r(1, 1).register(-1)]
    right[64].pitch = [ji.r(7, 6).register(1)]
    right[65].pitch = [ji.r(4, 3).register(-1), ji.r(1, 2)]
    """

    """

    right[56].pitch = [ji.r(7, 3)]
    # tw.rest(57, right)
    # print("right", len(right))

    ###############################################
    #          left hand                          #
    ###############################################

    tw.crop(6, left, F(1, 8))
    tw.add_kenong(7, left)
    left[7].volume = 1
    left[16].arpeggio = attachments.Arpeggio(abjad.enums.Down)
    tw.rest_many((19, 20, 21, 22, 23, 24, 25, 26), left)

    for n in (17, 18):
        left[n].optional = None
        left[n].volume = 0.75

    tw.crop(19, left, *([F(1, 4)] * 9))

    current_idx = 19
    for n, pitch in ((4, ji.r(35, 24)), (3, ji.r(3, 2)), (2, ji.r(72, 49))):
        is_first = True
        for _ in range(n):
            if is_first:
                tw.add_gong(current_idx, left, pitch)
                is_first = False
            else:
                tw.add_kenong(current_idx, left, pitch)
                left[current_idx].volume = 1

            current_idx += 1

    left[30].arpeggio = attachments.Arpeggio(abjad.enums.Down)

    tw.rest_many((31, 32), left)
    tw.split(31, left, F(1, 4), F(1, 4))
    tw.add_kenong(31, left, ji.r(3, 2))
    tw.add_kenong(32, left, ji.r(35, 24))

    left[34].arpeggio = attachments.Arpeggio(abjad.enums.Up)
    tw.rest_many((36, 38, 39, 40), left)
    tw.eat(35, 36, left)
    tw.eat(36, 37, left)
    tw.eat(36, 37, left)

    tw.eat(17, 18, left)
    tw.add_kenong(17, left, ji.r(288, 245))
    left[17].volume = 1.3

    # tw.make_solo_gong(36, left)
    tw.rest(36, left)
    left[37].arpeggio = attachments.Arpeggio(abjad.enums.Up)
    left[39].arpeggio = attachments.Arpeggio(abjad.enums.Up)
    tw.rest_many((38, 39), left)
    tw.eat(37, 38, left)
    tw.eat(38, 39, left)

    tw.rest(39, left)
    left[39].ottava = attachments.Ottava(0)
    left[39].pedal = attachments.Pedal(False)

    left[41].pedal = attachments.Pedal(True)
    left[42].arpeggio = attachments.Arpeggio(abjad.enums.Up)

    tw.make_solo_gong(44, left)
    tw.rest(43, left)
    tw.swap_duration(42, 43, F(1, 16), left)

    left[45].arpeggio = attachments.Arpeggio(abjad.enums.Up)

    left[58].optional = None
    left[58].volume = 0.75
    # tw.crop(59, left, F(1, 4), F(1, 4))
    tw.swap_duration(60, 59, F(1, 8), left)
    tw.add_gong(60, left, ji.r(72, 49))
    left[60].optional = None
    left[60].volume = 1

    tw.crop(42, left, F(1, 8))
    tw.add_kenong(43, left, ji.r(64, 63))
    left[43].volume = 1
    left[43].arpeggio = None
    left[44].ottava = attachments.Ottava(0)

    tw.swap_duration(48, 47, F(1, 8), left)
    tw.add_kenong(47, left, ji.r(64, 63))
    tw.add_kenong(48, left, ji.r(14, 9))
    left[47].volume = 1
    left[48].volume = 1
    tw.eat(48, 49, left)

    left[42].pitch = list(sorted(left[42].pitch)[:1])
    left[42].arpeggio = None

    tw.swap_duration(49, 50, F(2, 8), left)
    tw.add_kenong(50, left, ji.r(256, 245))
    left[50].volume = 1

    left[54].pitch = list(sorted(left[54].pitch)[:1])
    left[56].pitch = list(sorted(left[56].pitch)[:1])

    tw.rest(64, left)
    tw.swap_duration(64, 63, F(1, 4), left)
    # left[64].arpeggio = attachments.Arpeggio(abjad.enums.Down)
    left[64].arpeggio = None
    left[64].volume = 1

    tw.eat(62, 63, left)
    left[62].volume = 0.43
    tw.split(62, left, *([F(1, 4)] * int(left[62].delay // F(1, 4))))

    tw.split(60, left, F(3, 8), F(2, 8))
    left[61].ottava = attachments.Ottava(0)
    left[61].pedal = attachments.Pedal(False)
    left[61].volume = 0.5
    tw.split(61, left, F(1, 16), F(1, 16), F(1, 16), F(1, 16))
    left[61].pitch = [ji.r(64, 63)]
    left[62].pitch = [ji.r(35, 32).register(0)]
    left[63].pitch = [ji.r(64, 63)]
    left[64].pitch = [ji.r(7, 9)]

    left[68].arpeggio = attachments.Arpeggio(abjad.enums.Up)
    tw.eat(69, 70, left)

    tw.swap_duration(69, 70, F(1, 8), left)
    tw.add_kenong(70, left, ji.r(8, 5))

    left[78].volume = 0.5
    tw.crop(78, left, F(3, 16))
    left[80].volume = 0.5
    left[80].arpeggio = None
    tw.crop(80, left, F(1, 16), F(1, 16), F(1, 16))

    left[79].pitch = [ji.r(7, 9)]
    left[80].pitch = [ji.r(4, 7)]
    left[81].pitch = [ji.r(35, 24).register(-1)]
    tw.copy_pitch(80, 82, left)
    left[83].pitch = [ji.r(35, 32).register(0)]
    left[84].pitch = [ji.r(35, 24).register(-1)]

    tw.crop(84, left, F(1, 16), F(1, 16))
    left[85].pitch = [ji.r(4, 7).register(-1)]
    left[86].pitch = [ji.r(64, 63).register(-1)]

    tw.rest(83, left)
    tw.rest(86, left)

    tw.make_solo_gong(71, left)
    left[71].pedal = attachments.Pedal(True)

    tw.swap_duration(57, 58, F(1, 8), left)

    tw.rest_many((80, 81, 82, 84, 85, 87, 88, 89, 90, 91, 92, 93), left)

    tw.crop(80, left, F(1, 4), F(2, 4), F(2, 4), F(2, 4), F(3, 4), F(2, 4), F(3, 4))

    tw.add_kenong(80, left, ji.r(288, 245))
    tw.add_kenong(81, left, ji.r(384, 245))
    tw.add_kenong(82, left, ji.r(8, 5))
    tw.add_kenong(83, left, ji.r(256, 245))
    tw.add_kenong(84, left, ji.r(72, 49))
    tw.add_kenong(85, left, ji.r(7, 6))
    tw.add_kenong(86, left, ji.r(1, 1))
    tw.add_kenong(87, left, ji.r(1, 1))

    # for n in reversed(tuple(range(80, 87))):
    #     tw.crop(n, left, *([F(1, 8)] * int(left[n].delay // float(F(1, 8)))))

    tw.crop(75, left, F(1, 8))
    left[76].ottava = attachments.Ottava(0)
    left[76].pedal = attachments.Pedal(False)
    tw.crop(76, left, F(1, 16), F(3, 16), F(1, 8))
    left[76].pitch = [ji.r(1, 1)]
    left[77].pitch = [ji.r(7, 8)]
    left[78].pitch = [ji.r(7, 6)]
    left[79].pitch = [ji.r(4, 3)]
    left[80].pitch = [ji.r(72, 49)]
    # left[81].pitch = [ji.r(256, 245), ji.r(384, 245)]
    left[81].pitch = []
    left[81].volume = 0.65
    left[81].ottava = attachments.Ottava(0)
    left[82].pitch = [ji.r(288, 245)]
    tw.swap_duration(82, 83, F(1, 16), left)
    left[83].volume = 0.75
    left[83].pitch = [ji.r(256, 245)]

    tw.eat(83, 84, left)
    # tw.crop(83, left, F(1, 8))
    # left[84].pitch = [ji.r(144, 245), ji.r(24, 49)]
    tw.eat(80, 81, left)

    print("left", len(left))

    tw.crop(82, left, F(1, 8))
    tw.add_gong(83, left, ji.r(288, 245))

    # left[85].pedal = attachments.Pedal(True)

    tw.crop(90, left, F(6, 8))
    tw.add_gong(91, left, ji.r(14, 9))

    tw.swap_duration(80, 81, F(1, 8), left)
    tw.crop(81, left, F(1, 8))
    # tw.crop(83, left, F(1, 16))
    left[82].pitch = [ji.r(256, 245)]
    left[83].pitch = [ji.r(35, 48)]
    # left[84].pitch = [ji.r(288, 245).register(-1)]

    tw.crop(0, left, F(2, 8), F(1, 8))
    left[1].pitch = [ji.r(7, 24)]
    left[2].pitch = [ji.r(35, 128)]
    tw.crop(4, left, F(1, 4), F(1, 8), F(1, 8))
    left[5].pitch = [ji.r(12, 49)]
    left[6].pitch = [ji.r(96, 245)]
    left[7].pedal = attachments.Pedal(True)

    right[-1].fermata = attachments.Fermata("longfermata")
    left[-1].fermata = attachments.Fermata("longfermata")
Esempio n. 11
0
def _adapt_cello(cello: lily.NOventLine, vm) -> None:
    tw.change_octave(1, 1, cello)
    cello[1].optional = False
    cello[1].volume = 0.6
    tw.prolong(1, F(2, 8), cello)
    tw.crop(1, cello, F(1, 8), position=False)
    cello[2].acciaccatura = None
    cello[2].string_contact_point = PIZZ
    cello[2].pitch = [ji.r(1, 2)]
    cello[2].volume = 1.2
    # tw.change_octave(4, 1, cello)
    cello[4].volume = 0.6
    cello[5].pitch = [ji.r(7, 12)]
    # cello[5].string_contact_point = PIZZ
    # cello[5].volume = 1.9
    cello[5].string_contact_point = ARCO
    cello[5].volume = 0.5
    cello[6].volume = 0.56
    cello[6].natural_harmonic = attachments.NaturalHarmonic()
    tw.change_octave(6, 2, cello)
    cello[9].acciaccatura = None
    tw.shorten(9, F(3, 32), cello)

    tw.crop(7, cello, F(1, 16))
    tw.swap_duration(9, 8, F(1, 16), cello)
    cello[8].pitch = [ji.r(72, 49).register(-1)]
    cello[8].string_contact_point = ARCO
    cello[8].volume = 0.5
    cello[9].glissando = None

    cello[12].acciaccatura = None
    tw.copy_pitch(10, 12, cello)

    tw.crop(11, cello, F(1, 16), position=False)
    cello[12].string_contact_point = ARCO
    cello[12].volume = 0.5
    cello[12].pitch = [ji.r(72, 49).register(-1)]
    tw.crop(13, cello, F(1, 8), position=False)
    tw.prolong(14, F(1, 8), cello)
    cello[14].pitch = [ji.r(7, 6).register(-1)]

    tw.rest_many((15, 17, 18, 20, 21, 23), cello)
    tw.crop(15, cello, F(3, 4), F(3, 4), F(2, 4))

    cello[16].pitch = [ji.r(12, 7).register(-2)]
    cello[17].pitch = [ji.r(72, 49).register(-1)]

    for n in (16, 17):
        cello[n].string_contact_point = ARCO
        cello[n].volume = 0.5

    tw.prolong(14, F(3, 4), cello)
    tw.rest_many((18, 19, 21, 23), cello)

    tw.crop(
        17,
        cello,
        F(7, 4) + F(1, 8),
        F(1, 4),
        F(1, 8),
        F(1, 4),
        F(1, 4),
        F(1, 2),
        F(1, 4),
    )

    cello[18].pitch = [ji.r(12, 7).register(-1)]
    cello[19].pitch = [ji.r(7, 6).register(-1)]
    cello[20].pitch = [ji.r(16, 15).register(-1)]
    cello[22].pitch = [ji.r(1, 1).register(-1)]
    cello[23].pitch = [ji.r(7, 6).register(-2)]

    for n in (18, 19, 20, 23):
        cello[n].string_contact_point = PIZZ
        cello[n].volume = 1.2

    for n in (22,):
        cello[n].string_contact_point = ARCO
        cello[n].volume = 0.4

    tw.swap_duration(25, 24, F(1, 4), cello)
    tw.prolong(25, F(1, 16), cello)

    tw.crop(26, cello, F(1, 8))
    tw.change_octave(27, -1, cello)
    cello[27].string_contact_point = PIZZ
    cello[27].volume = 1.2

    tw.rest_many((29, 31), cello)

    tw.crop(22, cello, F(1, 8), position=False)
    cello[23].string_contact_point = PIZZ
    cello[23].volume = 2
    cello[23].pitch = [ji.r(1, 4)]

    tw.prolong(28, F(1, 8) + F(3, 4), cello)

    cello[29].pitch = [ji.r(1, 4)]
    cello[29].volume = 2
    cello[29].string_contact_point = PIZZ
    [tw.eat(29, 30, cello) for _ in range(2)]

    tw.crop(28, cello, F(1, 8))
    cello[29].pitch = [ji.r(16, 15).register(-2)]

    tw.swap_duration(32, 33, F(1, 8), cello)

    cello[33].pitch = [ji.r(256, 189).register(-1)]
    cello[33].volume = 0.3
    cello[33].string_contact_point = ARCO
    # tw.add_artifical_harmonic(33, ji.r(256, 189).register(-2), cello)

    tw.swap_duration(34, 33, F(1, 16), cello)

    tw.crop(33, cello, F(1, 8))
    tw.rest(33, cello)

    cello[36].pitch = [ji.r(384, 245).register(-1)]
    cello[36].volume = 0.4
    cello[36].string_contact_point = ARCO

    cello[31].ornamentation = attachments.OrnamentationUp(3)

    for n in (34, 35, 36):
        cello[n].string_contact_point = PIZZ
        cello[n].volume = 1.5

    for n in (40, 41, 43):
        cello[n].acciaccatura = None
        tw.change_octave(n, -1, cello)
        cello[n].artifical_harmonic = None

    tw.crop(52, cello, F(1, 8), F(2, 16), F(2, 16), F(3, 8))
    cello[55].pitch = [ji.r(72, 49).register(-1)]
    cello[55].volume = 0.6
    cello[55].string_contact_point = ARCO

    tw.prolong(43, F(1, 32), cello)

    tw.prolong(38, F(1, 8), cello)

    tw.crop(43, cello, F(1, 8))

    cello[43].pitch = [ji.r(384, 245).register(-1)]
    cello[44].pitch = [ji.r(6, 7)]
    for n in (38, 39, 43, 44, 45):
        cello[n].string_contact_point = PIZZ
        cello[n].volume = 1.4

    for n in (48, 52, 53, 54):
        if n == 53:
            cello[n].pitch = [ji.r(384, 245).register(-1)]
        else:
            cello[n].pitch = [ji.r(6, 7)]
        cello[n].volume = 0.4
        cello[n].string_contact_point = ARCO

    # tw.eat(53, 54, cello)

    # tw.add_glissando(51, (0, 0, 2), cello, durations=[F(3, 16), F(1, 8)])
    # tw.add_glissando(52, (0, -2), cello)
    cello[51].acciaccatura = None

    tw.shorten(51, F(1, 8), cello)

    [tw.rest(58, cello) for _ in range(3)]

    tw.crop(
        57,
        cello,
        F(1, 4),
        F(1, 8),
        F(1, 8),
        F(1, 16),
        F(3, 16),
        F(1, 8),
        F(1, 8),
        position=False,
    )

    for n, pitch in (
        (58, ji.r(7, 6)),
        (59, ji.r(1, 1)),
        (60, ji.r(16, 15)),
        (61, ji.r(1, 1)),
        (62, ji.r(1, 4)),
    ):
        if n != 62:
            tw.add_artifical_harmonic(n, pitch + ji.r(1, 2), cello)
        cello[n].pitch = [pitch + ji.r(2, 1)]
        if n == 62:
            cello[n].string_contact_point = PIZZ
            cello[n].volume = 1.6
        else:
            cello[n].string_contact_point = ARCO
            cello[n].volume = 0.4

    cello[63].pitch = [ji.r(8, 15)]
    cello[63].string_contact_point = PIZZ
    cello[63].volume = 1.25

    for n in (64, 67):
        cello[n].string_contact_point = ARCO
        cello[n].volume = 0.45

    tw.split(64, cello, F(3, 16), F(1, 16))
    cello[64].pitch = [ji.r(7, 12)]
    cello[65].pitch = [ji.r(1, 2)]

    cello[67].pitch = [ji.r(384, 245).register(-1)]
    cello[68].pitch = [ji.r(72, 49).register(-1)]

    cello[70].acciaccatura = None
    tw.change_octave(70, 1, cello)

    cello[71].pitch = [ji.r(72, 49).register(-1)]
    cello[71].string_contact_point = ARCO
    cello[71].volume = 0.45

    [tw.eat(71, 72, cello) for _ in range(2)]

    tw.crop(71, cello, F(1, 8))
    cello[72].pitch = [ji.r(384, 245).register(-1)]

    tw.shorten(73, F(3, 16), cello)

    cello[75].optional = None
    cello[75].acciaccatura = None
    cello[75].string_contact_point = PIZZ
    cello[75].volume = 1.5
    tw.swap_duration(74, 75, F(1, 16), cello)

    cello[56].string_contact_point = PIZZ
    cello[56].volume = 1.5
    tw.crop(56, cello, F(1, 8))
    cello[56].pitch = [ji.r(384, 245).register(-1)]
    cello[55].pitch = [ji.r(72, 49).register(-1)]

    tw.rest(51, cello)

    cello[63].string_contact_point = PIZZ
    cello[63].volume = 1.4

    tw.rest_many((74, 76, 78, 80), cello)

    print("cello", len(cello))

    tw.prolong(72, F(1, 16) + F(1, 4), cello)
    tw.crop(
        73,
        cello,
        F(2, 4),
        F(1, 4),
        F(1, 4),
        F(2, 4),
        F(1, 4),
        F(1, 4),
        F(1, 4),
        F(2, 4),
        F(7, 4),
    )

    tw.swap_duration(72, 71, F(1, 16), cello)

    cello[72].pitch = [ji.r(72, 49).register(1)]
    cello[73].pitch = [ji.r(384, 245).register(0)]
    cello[75].pitch = [ji.r(16, 15).register(0)]
    cello[76].pitch = [ji.r(384, 245).register(0)]
    cello[78].pitch = [ji.r(12, 7).register(0)]
    cello[79].pitch = [ji.r(72, 49).register(0)]
    cello[80].pitch = [ji.r(7, 6).register(0)]
    cello[81].pitch = [ji.r(1, 1).register(0)]

    for n in (72, 73, 75, 76, 78, 79, 80, 81):
        cello[n].string_contact_point = attachments.StringContactPoint(
            "molto sul tasto"
        )
        cello[n].volume = 0.3

    cello[72].string_contact_point = attachments.StringContactPoint("sul tasto")
    cello[69].pitch = [ji.r(7, 6).register(0)]

    tw.change_octave(75, 1, cello)

    for n in (72, 73, 75, 76, 78, 79):
        tw.add_artifical_harmonic(n, cello[n].pitch[0] - ji.r(4, 1), cello)

    cello[81].natural_harmonic = attachments.NaturalHarmonic()

    """
    tw.postpone(72, F(1, 8), cello)
    """

    tw.crop(0, cello, F(1, 8), F(1, 8))
    cello[1].pitch = [ji.r(1, 2)]
    cello[2].pitch = [ji.r(7, 12)]
    tw.set_pizz(1, cello)
    tw.set_pizz(2, cello)

    tw.swap_duration(2, 3, F(1, 32), cello)

    tw.crop(5, cello, F(1, 4))
    cello[5].pitch = [ji.r(3, 7)]
    tw.set_pizz(5, cello)

    for n in range(15, 20):
        cello[n].string_contact_point = attachments.StringContactPoint("sul tasto")

    cello[25].string_contact_point = attachments.StringContactPoint("arco ordinario")

    for n in range(29, 31):
        cello[n].string_contact_point = attachments.StringContactPoint("arco sul tasto")
        cello[n].dynamic = attachments.Dynamic('ppp')

    cello[31].dynamic = attachments.Dynamic('pp')

    for n in range(34, 36):
        cello[n].string_contact_point = attachments.StringContactPoint("arco ordinario")
Esempio n. 12
0
def _adapt_viola(viola: lily.NOventLine, vm) -> None:
    viola[1].pitch = viola[1].pitch[:1]
    viola[1].choose = False
    viola[1].optional = False
    viola[1].volume = 0.65
    tw.prolong(1, F(1, 4), viola)
    tw.crop(1, viola, F(1, 4))
    viola[1].pitch = [ji.r(35, 48)]
    viola[2].string_contact_point = PIZZ
    viola[2].volume = 2
    tw.crop(3, viola, F(1, 4))
    viola[4].pitch = [ji.r(48, 49).register(-2)]
    viola[6].pitch = [ji.r(4, 7)]
    viola[8].pitch = [ji.r(35, 48)]

    tw.prolong(9, F(1, 4), viola)
    tw.crop(9, viola, F(1, 8), F(1, 8), F(3, 16), F(1, 16))
    viola[9].pitch = [ji.r(48, 49)]
    viola[11].pitch = [ji.r(35, 48)]
    viola[12].pitch = [ji.r(4, 7)]

    for n in (4, 5, 6, 7, 8, 9, 10, 11, 12):
        if n < 9:
            tw.change_octave(n, 1, viola)
        viola[n].string_contact_point = ARCO
        viola[n].volume = 0.75
        viola[n].optional = None
        viola[n].acciaccatura = None

    # tw.add_glissando(9, (0, -1), viola)

    tw.change_octave(13, -1, viola)
    viola[13].optional = None
    viola[13].volume = 0.65

    tw.crop(14, viola, F(1, 4))
    viola[14].pitch = [ji.r(48, 49)]
    viola[14].volume = 2
    viola[14].string_contact_point = PIZZ

    viola[16].acciaccatura = None
    tw.rest_many((18, 20), viola)

    tw.prolong(16, F(1, 4), viola)

    tw.crop(17, viola, F(3, 4), F(2, 4))
    viola[17].pitch = [ji.r(4, 7)]
    viola[18].pitch = [ji.r(48, 49)]

    for n in (17, 18):
        viola[n].string_contact_point = ARCO
        viola[n].volume = 0.5

    viola[22].acciaccatura = None
    viola[24].acciaccatura = None

    tw.shorten(24, F(3, 16), viola)

    for n in (22, 23, 24):
        tw.change_octave(n, 1, viola)
        viola[n].glissando = None
        viola[n].string_contact_point = PIZZ
        viola[n].volume = 1

    tw.swap_duration(23, 21, F(1, 8), viola)

    tw.crop(25, viola, F(1, 4), F(1, 2), F(1, 4))

    viola[26].pitch = [ji.r(4, 5)]
    viola[26].string_contact_point = ARCO
    viola[26].volume = 0.6

    viola[27].pitch = [ji.r(7, 8)]
    viola[27].string_contact_point = PIZZ
    viola[27].volume = 1

    tw.rest(20, viola)
    tw.crop(26, viola, F(1, 8), position=False)
    viola[27].pitch = [ji.r(7, 8)]
    viola[27].volume = 0.7
    viola[27].string_contact_point = ARCO

    viola[28].acciaccatura = None

    viola[29].string_contact_point = PIZZ
    viola[29].volume = 1.9

    tw.crop(24, viola, F(1, 8), position=False)

    viola[25].string_contact_point = PIZZ
    viola[25].volume = 1.9
    viola[25].pitch = [ji.r(8, 7)]

    tw.prolong(30, F(3, 4), viola)

    viola[31].string_contact_point = PIZZ
    viola[31].volume = 2
    viola[31].pitch = [ji.r(7, 8)]

    tw.crop(30, viola, F(1, 8))
    tw.crop(32, viola, F(1, 8), position=False)
    viola[33].pitch = [ji.r(7, 4).register(-1)]
    viola[33].string_contact_point = ARCO
    viola[33].volume = 0.7

    viola[36].pitch = [ji.r(8, 5).register(-1)]
    viola[36].string_contact_point = ARCO
    viola[36].volume = 0.7
    tw.eat(36, 37, viola)

    viola[34].glissando = None
    tw.add_glissando(34, (0, 0, 2), viola, durations=[F(1, 4), F(1, 8)])
    # tw.change_octave(35, -1, viola)
    tw.split_by_structure(36, 3, viola, vm, adapt_by_changed_structure=True)

    viola[37].pitch = [ji.r(256, 245).register(-1)]
    viola[38].pitch = [ji.r(8, 5).register(-1)]
    # viola[40].pitch = [ji.r(8, 7).register(-1)]

    for n in (
        37,
        38,
    ):
        viola[n].volume = 0.55
        viola[n].string_contact_point = ARCO

    tw.change_octave(42, -1, viola)

    viola[44].acciaccatura = None

    tw.crop(35, viola, F(1, 8))

    for n in (36, 37, 38):
        viola[n].string_contact_point = PIZZ
        viola[n].volume = 1.4

    tw.eat(34, 35, viola)
    tw.add_glissando(34, (0, 0, 2, 2), viola, durations=[F(1, 4), F(1, 8), F(1, 8)])

    tw.crop(52, viola, F(2, 4) + F(1, 8), F(2, 8))

    viola[53].pitch = [ji.r(48, 49)]
    # viola[53].ornamentation = attachments.OrnamentationUp(1)

    for n in (46, 47, 49, 53):
        if n == 53:
            viola[n].string_contact_point = PIZZ
            viola[n].volume = 1.5
        else:
            viola[n].string_contact_point = ARCO
            viola[n].volume = 0.66
        viola[n].optional = None

    viola[51].optional = None
    viola[51].choose = None
    viola[51].volume = 0.66
    viola[51].pitch = [ji.r(256, 245)]

    tw.swap_duration(41, 42, F(1, 16), viola)
    viola[41].pitch = [ji.r(4, 7)]
    tw.swap_duration(40, 41, F(1, 8), viola)

    for n in (40, 41):
        viola[n].string_contact_point = PIZZ
        viola[n].volume = 1.4

    tw.add_glissando(38, (0, 0, -2), viola, durations=[F(1, 8), F(1, 8)])

    tw.split(43, viola, F(1, 4), F(1, 8), F(1, 8))

    for n in (44, 45, 46):
        viola[n].volume = 1.5
        viola[n].string_contact_point = PIZZ

    viola[45].pitch = [ji.r(8, 7)]
    viola[46].pitch = [ji.r(4, 3)]

    tw.change_octave(59, 1, viola)

    tw.crop(59, viola, F(1, 8))
    viola[60].pitch = [ji.r(4, 3)]
    viola[60].string_contact_point = PIZZ
    viola[60].volume = 1.25

    viola[62].string_contact_point = ARCO
    viola[62].volume = 0.5
    viola[62].optional = None
    tw.prolong(62, F(1, 8), viola)
    tw.crop(62, viola, F(1, 8), F(1, 8))
    viola[63].pitch = [ji.r(35, 48)]
    viola[64].pitch = [ji.r(7, 8)]

    viola[65].string_contact_point = ARCO
    viola[65].volume = 0.5
    viola[65].pitch = [ji.r(48, 49)]

    viola[66].acciaccatura = None
    tw.change_octave(66, 1, viola)

    tw.split_by_structure(69, 2, viola, vm, adapt_by_changed_structure=True)
    viola[69].pitch = [ji.r(4, 3)]
    viola[70].pitch = [ji.r(48, 49)]

    viola[71].pitch = [ji.r(256, 245).register(-1)]
    viola[71].string_contact_point = ARCO
    viola[71].volume = 0.5

    tw.rest(72, viola)
    tw.rest(73, viola)

    tw.crop(72, viola, F(1, 4) + F(3, 16), F(1, 16))
    viola[73].pitch = [ji.r(35, 24).register(-1)]
    viola[73].string_contact_point = PIZZ
    viola[73].volume = 1.4

    tw.rest(52, viola)

    tw.crop(51, viola, F(1, 16), position=False)
    viola[52].pitch = [ji.r(256, 245)]
    viola[52].string_contact_point = PIZZ
    viola[52].volume = 1.5

    viola[60].pitch = [ji.r(7, 8)]
    viola[60].string_contact_point = PIZZ
    viola[60].volume = 1.5

    tw.rest_many((72, 74, 76, 78), viola)

    tw.crop(
        71,
        viola,
        F(1, 4) + F(3, 4),
        F(2, 4),
        F(2, 4),
        F(4, 4),
        F(4, 4),
        F(2, 4),
        F(2, 4),
    )
    viola[71].pitch = [ji.r(48, 49).register(0)]
    viola[72].pitch = [ji.r(8, 5).register(0)]
    viola[73].pitch = [ji.r(256, 245).register(0)]
    viola[74].pitch = [ji.r(48, 49).register(-1)]
    viola[75].pitch = [ji.r(7, 4).register(-1)]
    viola[76].pitch = [ji.r(8, 5).register(-1)]
    viola[77].pitch = [ji.r(4, 3).register(-1)]

    for n in range(71, 78):
        viola[n].string_contact_point = attachments.StringContactPoint(
            "molto sul tasto"
        )
        viola[n].volume = 0.3

    viola[71].string_contact_point = attachments.StringContactPoint("sul tasto")

    tw.change_octave(69, 1, viola)
    tw.change_octave(70, 2, viola)

    viola[67].pitch = [ji.r(8, 7)]
    tw.set_arco(67, viola)

    tw.eat(68, 67, viola)
    # tw.crop(67, viola, F(1, 8), position=False)
    # viola[68].pitch = [ji.r(8, 5)]

    """
    tw.postpone(71, F(1, 4), viola)
    """

    print("viola", len(viola))
    viola[-1].fermata = attachments.Fermata("longfermata")

    tw.crop(2, viola, F(1, 4))
    viola[3].pitch = [ji.r(48, 49)]
    tw.set_pizz(3, viola)

    for n in range(16, 19):
        viola[n].string_contact_point = attachments.StringContactPoint("arco sul tasto")

    viola[24].string_contact_point = attachments.StringContactPoint("arco ordinario")

    for n in range(28, 30):
        viola[n].string_contact_point = attachments.StringContactPoint("arco sul tasto")
        viola[n].dynamic = attachments.Dynamic('ppp')

    viola[30].dynamic = attachments.Dynamic('pp')

    for n in range(33, 35):
        viola[n].string_contact_point = attachments.StringContactPoint("arco ordinario")
Esempio n. 13
0
def _adapt_violin(violin: lily.NOventLine, vm) -> None:
    tw.change_octave(4, 1, violin)
    tw.change_octave(5, 1, violin)
    tw.change_octave(6, -1, violin)
    tw.change_octave(7, -1, violin)
    violin[7].optional = None
    violin[7].volume = 1.2
    tw.split_by_structure(5, 3, violin, vm, adapt_by_changed_structure=True)
    violin[6].pitch = [ji.r(16, 9).register(0)]
    tw.split_by_structure(3, 2, violin, vm, adapt_by_changed_structure=True)
    tw.split_by_structure(1, 2, violin, vm, adapt_by_changed_structure=True)
    violin[2].acciaccatura = None
    violin[5].acciaccatura = None

    tw.swap_duration(7, 8, F(1, 32), violin)
    tw.swap_duration(8, 9, F(3, 16), violin)
    tw.crop(10, violin, F(1, 4))
    violin[11].acciaccatura = None
    violin[11].pitch = [ji.r(48, 35)]

    tw.crop(9, violin, F(1, 16), F(1, 16))
    violin[9].pitch = [ji.r(64, 63).register(1)]
    violin[10].pitch = [ji.r(16, 9).register(0)]
    tw.add_glissando(8, (0, 1), violin)
    tw.add_glissando(9, (0, -1), violin)

    tw.crop(17, violin, F(4, 4), F(3, 4), F(2, 4))

    violin[17].pitch = [ji.r(35, 32).register(0)]
    violin[18].pitch = [ji.r(3, 2).register(-1)]
    violin[19].pitch = [ji.r(288, 245).register(0)]

    tw.crop(20, violin, F(7, 4) + F(1, 8), F(1, 4), F(1, 8))

    for n in (17, 18, 19, 21, 22):
        violin[n].string_contact_point = ARCO
        violin[n].volume = 0.5

    for n in (21, 22, 26):
        violin[n].string_contact_point = PIZZ
        violin[n].volume = 1.2

    violin[21].pitch = [ji.r(3, 2).register(0)]
    violin[22].pitch = [ji.r(35, 32).register(0)]

    for n in (24, 25, 26):
        tw.change_octave(n, 1, violin)

    tw.swap_duration(23, 24, F(1, 16), violin)
    violin[25].acciaccatura = None
    violin[26].acciaccatura = None
    tw.swap_duration(23, 24, F(1, 8), violin)
    tw.add_glissando(24, (2, 0, 0), violin, durations=[F(1, 8), F(1, 4)])
    violin[25].pitch = [ji.r(48, 35)]

    tw.prolong(26, F(1, 32), violin)
    tw.crop(27, violin, F(2, 4), F(1, 4))

    violin[28].pitch = [ji.r(35, 32)]
    violin[28].volume = 0.5
    violin[28].string_contact_point = ARCO

    tw.crop(29, violin, F(1, 4))

    violin[29].pitch = [ji.r(48, 35)]
    violin[29].volume = 1.2
    violin[29].string_contact_point = PIZZ

    tw.crop(27, violin, F(1, 8), position=False)
    violin[28].pitch = [ji.r(14, 9)]
    violin[28].volume = 0.5
    violin[28].string_contact_point = ARCO

    tw.crop(25, violin, F(1, 8), position=False)
    violin[26].pitch = [ji.r(3, 2)]
    violin[26].string_contact_point = PIZZ
    violin[26].volume = 1.2

    tw.crop(31, violin, F(1, 8))
    violin[31].pitch = [ji.r(3, 2)]

    tw.crop(31, violin, F(1, 8))

    # tw.eat(33, 34, violin)
    tw.eat(34, 35, violin)

    violin[35].optional = None

    tw.crop(35, violin, F(1, 8))

    violin[36].pitch = [ji.r(48, 35)]
    violin[36].volume = 0.4
    # violin[36].string_contact_point = ARCO
    violin[36].acciaccatura = None

    violin[39].pitch = [ji.r(3, 4)]
    violin[39].volume = 0.6
    violin[39].string_contact_point = ARCO

    tw.swap_duration(38, 39, F(3, 32), violin)
    tw.crop(39, violin, F(1, 8))
    tw.rest(40, violin)
    tw.eat(39, 38, violin)
    # tw.swap_duration(39, 40, F(1, 4), violin)

    violin[39].pitch = [ji.r(288, 245)]
    violin[39].volume = 0.6
    violin[39].string_contact_point = ARCO

    tw.swap_duration(42, 41, F(1, 16), violin)

    tw.eat(39, 40, violin)
    tw.crop(40, violin, F(1, 8))

    for n in (41, 43):
        violin[n].string_contact_point = PIZZ
        violin[n].volume = 2

    violin[41].hauptstimme = attachments.Hauptstimme(True, False)
    violin[42].hauptstimme = attachments.Hauptstimme(True, False)
    violin[43].hauptstimme = attachments.Hauptstimme(False, False)
    violin[44].hauptstimme = attachments.Hauptstimme(False, False)
    violin[45].hauptstimme = attachments.Hauptstimme(False, True)
    violin[46].hauptstimme = None

    tw.eat(39, 40, violin)
    tw.add_glissando(39, (0, 0, -2, -2), violin, durations=[F(1, 4), F(1, 8), F(1, 8)])

    tw.crop(47, violin, F(1, 8), F(2, 4) + F(4, 4), F(1, 4) + F(0, 8), F(3, 8))

    for n in (48, 50):
        violin[n].pitch = [ji.r(288, 245)]
        if n == 50:
            violin[n].string_contact_point = PIZZ
            violin[n].volume = 1.8
        else:
            violin[n].string_contact_point = ARCO
            violin[n].volume = 0.55

    tw.split_by_structure(
        48, 5, violin, vm, adapt_by_changed_structure=True, set_n_novents2rest=2
    )

    tw.crop(45, violin, F(1, 8))
    tw.crop(46, violin, F(2, 4), F(1, 8), F(1, 8))

    violin[45].pitch = [ji.r(7, 9)]

    violin[47].pitch = [ji.r(288, 245)]
    violin[48].pitch = [ji.r(48, 35)]
    violin[49].pitch = [ji.r(14, 9)]

    for n in (44, 45, 47, 48, 49):
        violin[n].volume = 1.5
        violin[n].string_contact_point = PIZZ

    # tw.swap_duration(51, 52, F(1, 8), violin)
    tw.shorten(52, F(1, 8), violin)
    tw.rest(55, violin)

    tw.rest(60, violin)
    tw.crop(59, violin, F(5, 8), F(1, 8))

    violin[60].pitch = [ji.r(48, 35)]
    violin[61].pitch = [ji.r(288, 245)]
    violin[62].pitch = [ji.r(8, 9)]

    for n in (60, 61):
        violin[60].volume = 0.4
        violin[60].string_contact_point = ARCO

    for n in (66, 67):
        violin[n].glissando = None
        violin[n].acciaccatura = None
        violin[n].string_contact_point = PIZZ
        violin[n].volume = 1.5

    tw.swap_duration(55, 56, F(1, 16), violin)
    tw.crop(56, violin, F(1, 16), F(1, 8))
    violin[56].pitch = [ji.r(3, 2)]
    violin[57].pitch = [ji.r(48, 35)]

    tw.crop(59, violin, F(1, 8), F(1, 8), position=False)

    violin[60].pitch = [ji.r(3, 4)]
    violin[61].pitch = [ji.r(8, 9)]
    violin[62].pitch = [ji.r(3, 2)]
    for n in (60, 61, 62):
        violin[n].volume = 1.5
        violin[n].string_contact_point = PIZZ

    tw.rest_many((70, 71, 72, 74), violin)

    tw.crop(
        69,
        violin,
        F(1, 32) + F(3, 4),
        F(5, 4),
        F(2, 4),
        F(1, 4),
        F(3, 4),
        F(1, 4),
        F(2, 4),
    )

    tw.swap_duration(68, 69, F(1, 32), violin)

    violin[69].pitch = [ji.r(288, 245).register(1)]
    violin[70].pitch = [ji.r(48, 35).register(0)]
    violin[71].pitch = [ji.r(288, 245).register(0)]
    violin[73].pitch = [ji.r(3, 2).register(0)]
    violin[74].pitch = [ji.r(8, 9).register(-1)]
    violin[76].pitch = [ji.r(7, 9).register(-1)]

    for n in (69, 70, 71, 73, 74, 76):
        violin[n].string_contact_point = attachments.StringContactPoint(
            "molto sul tasto"
        )
        violin[n].volume = 0.3

    violin[69].string_contact_point = attachments.StringContactPoint("sul tasto")

    # for n in (70, 71):
    #     tw.change_octave(n, 1, violin)

    violin[76].volume = 0.4

    tw.change_octave(66, 1, violin)
    tw.change_octave(68, 1, violin)
    violin[68].acciaccatura = None
    # tw.crop(68, violin, F(1, 8), position=False)
    # violin[69].pitch = [ji.r(48, 35).register(1)]

    # tw.crop(65, violin, F(1, 32), position=False)
    # violin[66].pitch = [ji.r(3, 2)]
    violin[66].pitch = [ji.r(14, 9)]
    violin[67].pitch = [ji.r(16, 9)]
    tw.set_arco(66, violin)
    tw.set_arco(67, violin)
    """
    tw.postpone(69, F(1, 16), violin)
    """

    print("violin", len(violin))
    violin[-1].fermata = attachments.Fermata("longfermata")

    tw.crop(0, violin, F(1, 8), F(1, 8))
    violin[1].pitch = [ji.r(3, 4)]
    violin[2].pitch = [ji.r(7, 9)]
    tw.set_pizz(1, violin)
    tw.set_pizz(2, violin)

    tw.swap_duration(2, 3, F(1, 32), violin)

    # tw.rest(1, violin)
    tw.eat(1, 0, violin)
    # tw.crop(4, violin, F(1, 8), F(1, 4))
    # violin[5].pitch = [ji.r(48, 35)]
    # tw.set_pizz(5, violin)

    for n in range(17, 21):
        violin[n].string_contact_point = attachments.StringContactPoint(
            "arco sul tasto"
        )

    for n in range(25, 27):
        violin[n].string_contact_point = attachments.StringContactPoint(
            "arco ordinario"
        )

    for n in range(30, 32):
        violin[n].dynamic = attachments.Dynamic('ppp')
        violin[n].string_contact_point = attachments.StringContactPoint(
            "arco sul tasto"
        )

    violin[32].dynamic = attachments.Dynamic('pp')

    for n in range(36, 38):
        violin[n].string_contact_point = attachments.StringContactPoint(
            "arco sul ponticello"
        )

    for n in range(39, 41):
        violin[n].string_contact_point = attachments.StringContactPoint("ordinario")