Ejemplo n.º 1
0
def score1(lib):
    s = score.ImaginaryScore()
    sb = lib("integrate_block1")

    s = sb().annotate(slur_cells=True, label=(
        "phrases",
        "cells",
    )).to_score(s)

    # drum_off_cell.note_events[1].tag("brushes")
    # drum_on_off_cell.note_events.tag("note_head:0:cross")
    # drum_on_off_cell.note_events.tag("note_head:1:cross")

    drum_set = ImaginarySegment(
        lib("drum_on_off"),
        get_improv_line(rhythm=(1, ) * 8, times=7).ops("cells")(6, "\\<")(),
        get_improv_line(instruction="improv, solo",
                        rhythm=(0.5, ) * 8,
                        times=1).eps(0, "mf")(),
    )
    s.staves["ooa_drum_set"].append(drum_set)

    string_staves = (
        "ooa_violin1",
        "ooa_violin2",
        "ooa_cello1",
        "ooa_cello2",
        "cco_violin_i",
        "cco_violin_ii",
        "cco_viola",
        "cco_cello",
    )

    s.extend_from(
        pulse_on_off_beat.PulseOnOffBeat(
            sb,
            fabric_staves=string_staves,
            phrase_beats=(8, ) * 8,
            ranges=pitch_ranges.LOW_TO_HIGHISH_RANGES,
        ), )

    # CCO cello and viola come in first ... then
    for st in s.staves["ooa_cello1", "ooa_cello2"]:
        st.segments[0].mask("cells", 0, 1)
    for st in s.staves["cco_violin_i", "cco_violin_ii", ]:
        st.segments[0].mask(
            "cells",
            0,
            1,
            2,
            3,
        )
    for st in s.staves["ooa_violin1", "ooa_violin2"]:
        st.segments[0].mask("cells", 0, 1, 2, 3, 4, 5)

    timp_seg = s.staves["cco_cello"].segments[0]()
    for n in timp_seg.note_events:
        if not n.pitch in (-22, -15, -10):
            n.pitch = "R"
    timp_seg.cells[12, 13].note_events.tag(">")
    timp_seg.transformed(calliope.StandardDurations()).eps(
        0, "\\timpStaff", "timpani", "p")()
    s.staves["cco_percussion"].append(timp_seg)

    for st in s.staves[string_staves]:
        st.note_events[0].tag("arco", "p")
        st.phrases[3].e_smear_after(0, cover_notes=True,
                                    extend_beats=3.5).eps(0, "\\<")()
        st.cells[7].tag("mf")
        st.cells[13].e_smear_after(0, extend_beats=2.5,
                                   cover_notes=True).eps(0, "\\mp", "\\<")()()
        st.cells[13].eps(1, "mf", ">", ".")()
        st.cells[14].eps(0, ">", ".")()

    bass_seg = s.staves["cco_cello"].segments[0]()
    for n in bass_seg.cells[4:].note_events:
        n.pitch = sb.pitches_at(n.beats_before(bass_seg))[0] + 12
    for c in bass_seg.cells[14:]:
        c.t(1)
    s.staves["cco_bass"].append(bass_seg)

    s.extend_from(
        lambda_segment.LambdaSegments(
            sb.with_only("bass_line", ),
            fabric_staves=("ooa_bassoon", "cco_bassoon"),
            funcs=(
                lambda x: x.crop_chords(indices=(0, 1)).crop("cells", 0, 1),
                lambda x: x.crop_chords(indices=(1, 0)).crop("cells", 0, 1),
            ),
            tag_all_note_events=("-", )))
    s.extend_from(
        lambda_segment.LambdaSegments(
            sb.with_only("melody_line1"),
            fabric_staves=("harp1", "harp2"),
            funcs=(
                lambda x: x.crop_chords(indices=(1, )).ops("note_events")
                (0, "mp")(),
                lambda x: x.crop_chords(indices=(0, )).t(-12),
            ),
        ))

    # s.extend_from(
    #     lambda_segment.LambdaSegments(
    #         sb.with_only("counter_line"),
    #         # assign_pitches_from_selectable = True,
    #         fabric_staves = ("piano1","piano2"),
    #         func = lambda x: x.transformed(
    #                 calliope.StandardDurations(
    #                     min_duration=0.25,
    #                     standard_duration=0.5,)
    #                 ).e_smear_after(4, cover_notes=True, extend_beats=1
    #                 ).e_smear_after(6, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(8, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(10, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(16, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(19, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(22, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(29, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(33, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(35, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(46, cover_notes=True, extend_beats=0.5
    #                 ).e_smear_after(86, cover_notes=True, extend_beats=0.5
    #                 ).mask("events",24,25,27,31
    #                 ).mask("cells",26,27,29,31).slur_cells(#).label("events","cells"
    #                 ),
    #         funcs = (
    #             lambda x: x.crop_chords(indices=(1,)).transformed(
    #                 calliope.SmartRange(
    #                     smart_range = (12,26),
    #                     )
    #                 ),
    #             lambda x: x.crop_chords(indices=(0,)).t(-12).transformed(
    #             ),
    #         )
    #         )
    #     )
    # harp_piano_combo = calliope.CompositeChordsLine(
    #     calliope.LineBlock(
    #         ImaginaryLine(*s.staves["harp2"].cells.copy()),
    #         ImaginaryLine(*s.staves["piano2"].cells.copy())),
    #     ).transformed(artics.GroupByBeats())
    # s.staves["ooa_mallets"].append(ImaginarySegment(harp_piano_combo))

    # s.extend_from(
    #     lambda_segment.LambdaSegments(
    #         sb.with_only("melody_line2"),
    #         fabric_staves = ("piano1","piano2"),
    #         funcs = (
    #             lambda x: x.crop_chords(indices=(1,)),
    #             lambda x: x.crop_chords(indices=(0,)).t(-12),
    #             ),
    #         )
    #     )
    guitars = osti.Osti(
        sb.with_only("bass_drones"),
        fabric_staves=(
            "ooa_bass_guitar",
            "ooa_guitar",
        ),
        ranges=pitch_ranges.MID_RANGES,
        osti_pulse_duration=1,
        osti_cell_length=16,
        osti_cell_count=4,
    )
    s.extend_from(
        staggered_swell.StaggeredSwells(
            sb.with_only("high_drones"),
            fabric_staves=("ooa_flute", "cco_flute1", "cco_flute2"),
            low_dynamic="p",
            swell_dynamic="mf",
            swell_duration=8,
            cell_count=2,
            phrase_count=4,
        ),
        guitars,
    )

    harp_lh = s.staves["harp2"].segments[0]
    for n in harp_lh.note_events:
        pitches_at_sb = sb.pitches_at(n.beats_before(harp_lh))
        n.pitch = (pitches_at_sb[1], pitches_at_sb[-4])
    harp_lh.smart_ranges([(-14, 4)])
    # now remove dupes
    for n in harp_lh.note_events:
        n.pitch = set(n.pitch)
    for c in harp_lh.cells:
        c.mask("note_events", -1, -2)
    harp_lh.transformed(calliope.StandardDurations())

    piano_rh = ImaginarySegment(
        ImaginaryLine(
            ImaginaryCell(rhythm=(-4, )),
            ImaginaryPhrase(
                ImaginaryCell(rhythm=(0.25, 1.75) * 2),
                ImaginaryCell(rhythm=(2, ) * 4),
            ) * 4,
        ))
    piano_lh = harp_lh()

    mallets = piano_rh()
    for n in mallets.note_events:
        n.pitch = sb.pitches_at(n.beats_before(mallets))[-3]
    s.staves["ooa_mallets"].append(mallets)
    mallets.eps(1, "mp")(8, 16, 22, 24, 30, ":32")()

    for n in piano_rh.note_events:
        if n.beats == 0.25:
            n.pitch = sb.pitches_at(n.beats_before(piano_rh))[-2]
            n.tag("(")
        elif n.beats == 1.75:
            n.pitch = sb.pitches_at(n.beats_before(piano_rh))[-1]
            n.tag(")")
        else:
            n.pitch = set(sb.pitches_at(n.beats_before(piano_rh))[-2:])
    for n in piano_lh.note_events:
        n.pitch = sb.pitches_at(n.beats_before(piano_lh))[1]
    piano_lh.fuse().slur_cells()
    for n in piano_lh.note_events:
        n.pitch = set(sb.pitches_at(n.beats_before(piano_lh))[1:3])

    s.staves["piano1"].append(piano_rh)
    s.staves["piano2"].append(piano_lh)

    s.fill_rests(beats=15 * 4)
    final_swell_sax_brass = swell_hit.SwellHit(
        sb.with_only("chords"),
        fabric_staves=instrument_groups.get_instruments(
            "sax",
            "brass",
        ),
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=15 * 4,
        low_dynamic="p",
        hit_dynamic="mf",
        swell_duration=7,
        hit_duration=1,
        hit_rest=0,
        hit_articulations=("-", ))
    s.extend_from(final_swell_sax_brass)

    s.fill_rests(beats=16 * 4)
    final_swell_winds_strings = swell_hit.SwellHit(
        sb.with_only("chords"),
        fabric_staves=instrument_groups.get_instruments(
            "winds",
            "strings",
        ),
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=16 * 4,
        low_dynamic="mp",
        hit_dynamic="f",
        swell_duration=3,
        hit_duration=1,
        hit_rest=0,
        hit_articulations=("-", ))
    s.extend_from(final_swell_winds_strings)

    # s.extend_from(final_block)

    s.fill_rests(fill_to="cco_violin_i")

    # s.only_staves("piano1", "piano2")
    # s.as_rhythm_and_short()

    # s.only_staves(*instrument_groups.get_instruments("cco_strings"))

    s.fill_rests()
    s.remove(s.staff_groups["short_score"])

    # s.lines.apply(lambda x:x.auto_respell())
    # s.phrases.apply(lambda x:x.auto_respell())

    for staff in s.staves:
        # staff.phrases.transformed(calliope.Label())
        # staff.lines.transformed(calliope.Label())

        # TO DO: WHY DOESN'T THIS WORK?????
        if segs := staff.segments:
            main_seg = segs[0]
            for next_seg in list(segs[1:]):
                main_seg.extend(next_seg)
                next_seg.parent.remove(next_seg)
            main_seg.rehearsal_mark_number = 11
            main_seg.compress_full_bar_rests = True
Ejemplo n.º 2
0
def score2(lib):
    s = score.ImaginaryScore()
    sb2 = lib("lyrical_block2")
    s = sb2().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s)

    drum_off_cell = ImaginaryCell(
        rhythm=(
            0.25,
            0.25,
            -0.5,
        ) + (0.5, 0.25, 0.25, -1) * 3 + (1, ),
        pitches=(
            (-8, 9),
            9,
            "R",
        ) + (9, (-8, 5), 4, "R") * 3 + ((-8, 9), ),
    )
    # drum_off_cell.note_events[1].tag("brushes")
    # drum_off_cell.annotate(label=("note_events",))
    drum_off_cell.note_events[0, 1, 2, 3, 5, 6, 8, 9,
                              11].tag("note_head:0:cross")
    drum_off_cell.note_events[0, 11].tag("note_head:1:cross")
    drum_offs = ImaginarySegment(
        drum_off_cell,
        get_improv_line(rhythm=(1, ) * 8, times=2),
        get_improv_line(instruction="improv", rhythm=(0.5, ) * 16, times=1),
        drum_off_cell,
        get_improv_line(instruction="improv", rhythm=(0.5, ) * 16, times=1),
    )
    sus_swell_cell = ImaginaryCell(rhythm=(6.5, 0.5,
                                           -1), ).eps(0, ":32", "p", "\\<")(
                                               1,
                                               ":32",
                                               "mp",
                                           )()
    cym_seg = ImaginarySegment(
        # TO DO... this would be good in the library...
        ImaginaryCell(rhythm=(1, -3), ).eps(0, ":32")(),
        ImaginaryCell(rhythm=(-4 * 3, )),
        sus_swell_cell().eps(2, "* dampen")(),
        ImaginaryCell(rhythm=(-4 * 2, )),
        sus_swell_cell().eps(2, "*")(),
        sus_swell_cell().eps(2, "*")(),
    )
    cym_seg.events[2, 5].tag(")")
    s.staves["cco_percussion"].append(cym_seg)

    s.staves["ooa_drum_set"].append(drum_offs)

    harp_guitar = lambda_segment.LambdaSegments(
        sb2.with_only("melody_line1", ),
        fabric_staves=("harp1", "ooa_guitar"),
        funcs=(
            lambda x: x.only_first(
                "cells",
                4,
            ).eps(1, "mf")(),
            lambda x: x.only_first(
                "cells",
                4,
            ).eps(1, "mp", "distorted")(),
        ))
    s.extend_from(harp_guitar)
    harp_end = lambda_segment.LambdaSegment(
        sb2.with_only("high_drones", ),
        fabric_staves=("harp1", ),
        func=lambda x: x.with_only("cells", 8, 9, 10, 11).t(-12),
    )
    s.extend_from(harp_end)

    flute_swells_args = dict(
        ranges=pitch_ranges.MID_RANGES,
        fabric_staves=(
            "cco_flute1",
            "cco_flute2",
        ),
        low_dynamic="p",
        hit_dynamic="mf",
        hit_duration=0.5,
        hit_rest=1,
    )
    cco_flute_swell1 = swell_hit.SwellHit(
        sb2.with_only("melody_line1", ),
        **flute_swells_args,
        bookend_beats=(1, 0),
        swell_duration=5.5,
        selectable_start_beat=0.5,
    )
    cco_flute_swell2 = swell_hit.SwellHit(
        sb2.with_only("melody_line1", ),
        **flute_swells_args,
        bookend_beats=(2, 0),
        swell_duration=4.5,
        selectable_start_beat=4 * 2 + 2.5,
    )
    cco_flute_swell3 = swell_hit.SwellHit(
        sb2.with_only("melody_line1", ),
        **flute_swells_args,
        bookend_beats=(1, 0),
        swell_duration=5.5,
        selectable_start_beat=4 * 4 + 0.5,
    )
    cco_flute_swell4 = swell_hit.SwellHit(
        sb2.with_only("melody_line1", ),
        **flute_swells_args,
        bookend_beats=(1, 0),
        swell_duration=5.5,
        selectable_start_beat=4 * 6 + 0.5,
    )

    s.extend_from(cco_flute_swell1,
                  cco_flute_swell2,
                  cco_flute_swell3,
                  cco_flute_swell4,
                  extend_last_machine=True)

    # TO DO: add ranges
    # =======================================================
    # melody and bass lines:
    violin_i1 = lambda_segment.LambdaSegment(
        sb2.with_only("counter_line", ),
        fabric_staves=("cco_violin_i", ),
        func=lambda x: x.with_only("cells", 0, 1, 2, 3).eps(0, 3, 5, 8, "(")
        (1, 4, 6, 9, ")")(),
        # tag_events = {0:("p", "normal")},
    )
    violin_i2 = lambda_segment.LambdaSegment(
        sb2.with_only("melody_line1", ),
        fabric_staves=("cco_violin_i", ),
        func=lambda x: x.with_only(
            "phrases",
            1,
        ).crop_chords(indices=(0, ), ).smart_ranges(((7, 19), )).t(12))
    # tag_events = {0:("p", "normal")},
    # TO DO: should be able to combine violin i, ii into one statement
    violin_ii = lambda_segment.LambdaSegment(
        sb2.with_only("melody_line1", ),
        bookend_beats=(16, 0),
        fabric_staves=("cco_violin_ii", ),
        func=lambda x: x.with_only(
            "phrases",
            1,
        ).crop_chords(indices=(1, ), ).smart_ranges(((14, 26), )),
        # tag_events = {0:("p", "normal")},
    )
    # TO DO: not great...
    viola = lambda_segment.LambdaSegment(
        sb2.with_only("melody_line1", ),
        fabric_staves=("cco_viola", ),
        func=lambda x: x.with_only("cells", 0, 1).crop_chords((
            0,
            0,
            1,
            0,
            0,
            0,
            0,
            1,
        )).smart_ranges(((0, 12), ), ),
        # tag_events = {0:("p", "normal")},
    ).extend_from(
        lambda_segment.LambdaSegment(
            sb2.with_only("counter_line", ),
            fabric_staves=("cco_viola", ),
            func=lambda x: x.with_only("cells", 4, 5, 6, 7).smart_ranges(
                ((-3, 12), ), )))
    s.extend_from(violin_i1, violin_i2, violin_ii, viola)

    # =======================================================
    # general textures:
    # TO DO: this pattern is used often ... DRY
    s.extend_from(
        lambda_segment.LambdaSegment(
            sb2.with_only("high_drones", "bass_drones"),
            fabric_staves=("piano1", "piano2"),
            func=lambda x: x,
        ))
    s.extend_from(
        lambda_segment.LambdaSegments(sb2.with_only("bass_drones"),
                                      fabric_staves=(
                                          "cco_bass",
                                          "ooa_bass_guitar",
                                      ),
                                      funcs=(
                                          lambda x: x.crop_chords(
                                              (0, ), ).eps(0, "arco", "mp")(),
                                          lambda x: x.t(12).eps(0, "p")(),
                                      )))
    ooa_strings_pulses = pulse_on_off_beat.PulseOnOffBeat(
        sb2,
        fabric_staves=(
            "ooa_violin1",
            "ooa_violin2",
            "ooa_cello1",
            "ooa_cello2",
        ),
        phrase_beats=(8, ) * 6,
        ranges=pitch_ranges.LOW_TO_HIGHISH_RANGES,
    )
    for st in ooa_strings_pulses.staves["ooa_violin1", "ooa_violin2"]:
        st.segments[0].mask("phrases", 0, 1)
    for st in ooa_strings_pulses.staves:
        st.note_events[0].tag("arco")
        for phrase in st.phrases:
            if phrase.note_events:
                phrase.note_events[0].tag(".", "p", "\\<")
                phrase.note_events[1:].tag("-")
                phrase.note_events[-1].tag("mf")
    s.extend_from(ooa_strings_pulses, )

    # =======================================================
    s.fill_rests(beats=16)
    # =======================================================
    # TO DO: this pitch assignment doesn't work well because
    # it always chooses top note (due to swell staggering)
    # TO FIX... make assign_pitches smart enough to know if pitch
    # already assigned from held over note
    s.extend_from(
        lyrical.SaxSwell(
            sb2,
            selectable_start_beat=16,
            ranges=pitch_ranges.get_ranges(ratio_mid=0.6, spread=16),
        ),
        lyrical.SaxSwell(sb2,
                         selectable_start_beat=24,
                         ranges=pitch_ranges.get_ranges(ratio_mid=0.6,
                                                        spread=16),
                         low_dynamic="p",
                         swell_dynamic="mf"),
    )

    mallets_pad = pad.MalletsPad(sb2,
                                 pad_durations=(2, ) * 8,
                                 selectable_start_beat=16)
    mallets_pad.segments[0].fuse()
    mallets_pad.note_events[0].tag("p", "\\<")
    s.extend_from(mallets_pad)
    s.extend_from(
        lambda_segment.LambdaSegment(
            sb2.with_only("high_drones"),
            fabric_staves=("ooa_mallets", ),
            func=lambda x: x.with_only("cells", 8, 9, 10, 11).t(-12).eps(
                0, "mf")(),
        ),
        extend_last_machine=True,
    )

    # adjust for bass 8va
    for bass_seg in s.staves["cco_bass"].segments:
        bass_seg.t(12)

    s.fill_rests(beats=6 * 4)

    brass_improv1 = improv.Improv(
        sb2,
        fabric_staves=instrument_groups.get_instruments("ooa_brass"),
        improv_times=2,
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=6 * 4 + 2,
        dynamic="p",
        after_func=lambda x: x.eps(0, "\\<")())
    brass_improv2 = improv.Improv(
        sb2,
        instruction="",
        fabric_staves=instrument_groups.get_instruments("ooa_brass"),
        improv_times=2,
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=8 * 4 + 2,
        dynamic="mf",
    )
    brass_improv3 = improv.Improv(
        sb2,
        instruction="",
        fabric_staves=instrument_groups.get_instruments("ooa_brass"),
        improv_times=2,
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=10 * 4 + 5,
    )

    s.extend_from(brass_improv1, brass_improv2, brass_improv3)

    s.fill_rests(beats=32)

    # =======================================================

    cello_viola_melody = lambda_segment.LambdaSegment(
        sb2.with_only("melody_line1", ),
        fabric_staves=("cco_viola", "cco_cello"),
        func=lambda x: x.with_only("cells", 4, 5, 6, 7).crop_chords(
            (0, )).eps(1, "mf")(
                5,
                9,
                11,
                "(",
            )(6, 10, 12, ")")(),
    )
    s.extend_from(cello_viola_melody)

    end_violins = swell_hit.SwellHit(
        sb2.with_only("high_drones"),
        fabric_staves=("cco_violin_i", "cco_violin_ii"),
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=8 * 4,
        low_dynamic="p",
        hit_dynamic="f",
        swell_duration=14.5,
        hit_duration=0.5,
        hit_rest=1,
    )
    for st in end_violins.staves:
        st.note_events[0].tag(":32")
    s.extend_from(end_violins)

    # =======================================================

    # s.fill_rests(beats=32)

    # =======================================================

    # s.extend_from(
    #     lyrical.OoaStringsPad(),
    #     lyrical.OoaStringsPad(),
    #     )

    # s.extend_from(
    #     lyrical.SaxSwell(),lyrical.SaxSwell(),lyrical.SaxSwell(),
    #     )

    # s.fill_rests(fill_to="ooa_alto_sax1")

    # =======================================================

    # s.extend_from(
    #     lyrical.PausePizzFlutter(
    #         pizz_flutter_initial = True,
    #         pizz_flutter_beats = 2,
    #         mask_staves=("cco_violin_i","cco_violin_ii"),
    #         ),
    #     )
    # s.extend_from(
    #     lyrical.PausePizzFlutter(
    #         pizz_flutter_beats = 6,
    #         extend_last_machine = True,
    #         mask_staves=("cco_violin_i","cco_violin_ii"),
    #         ),
    #     )
    #

    s.fill_rests(beats=12 * 4)
    # s.remove_empty()
    s.fill_rests()

    for staff in s.staves:
        if segs := staff.segments:
            main_seg = segs[0]
            for next_seg in list(segs[1:]):
                main_seg.extend(next_seg)
                next_seg.parent.remove(next_seg)
            main_seg.rehearsal_mark_number = 4
            main_seg.auto_respell()
            main_seg.compress_full_bar_rests = True
Ejemplo n.º 3
0
def score4(lib):
    s = score.ImaginaryScore()
    sb = lib("rock_block4")

    s = sb().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s)

    # riffs_block = short_block.ChordsToSegmentBlock(
    #     selectable = sb.with_only("riff",).segments[0],
    #     sort_chords=True,
    #     )

    # =======================================================#
    # bass line carries all the way through...

    s.extend_from(
        lambda_segment.LambdaSegment(
            calliope.SegmentBlock(
                ImaginarySegment(
                    get_improv_line(instruction="ad lib",
                                    rhythm=(1, ) * 4,
                                    times=22))),
            fabric_staves=("cco_percussion", ),
            func=lambda x: x.eps("\\percStaff")(),
        ))
    s.extend_from(
        lambda_segment.LambdaSegment(
            calliope.SegmentBlock(
                ImaginarySegment(
                    get_improv_line(instruction="ad lib with rolls",
                                    rhythm=(1, ) * 4,
                                    times=9).eps(8 * 4 - 2, "\\>")(8 * 4 + 3,
                                                                   "pp")())),
            fabric_staves=("cco_percussion", ),
            func=lambda x: x,
        ))
    s.extend_from(
        lambda_segment.LambdaSegment(
            calliope.SegmentBlock(
                ImaginarySegment(lib("rock_rhythm1"),
                                 get_improv_line(rhythm=(1, ) * 8, times=10))),
            fabric_staves=("ooa_drum_set", ),
            func=lambda x: x,
        ))
    s.extend_from(
        lambda_segment.LambdaSegment(
            calliope.SegmentBlock(
                ImaginarySegment(
                    get_improv_line(instruction="ad lib with rolls",
                                    rhythm=(1, ) * 4,
                                    times=9).eps(8 * 4 - 2, "\\>")(8 * 4 + 3,
                                                                   "pp")())),
            fabric_staves=("ooa_drum_set", ),
            func=lambda x: x,
        ))

    guitar_improv1 = improv.Improv(
        sb,
        instruction="improv, straight quarter notes on these pitches",
        fabric_staves=("ooa_guitar", "ooa_bass_guitar"),
        improv_times=2,
        ranges=pitch_ranges.MID_RANGES,
        dynamic="mf",
        pitch_selectable_indices=((0, 2, 4, 5), ),
    )
    guitar_improv2 = improv.Improv(
        sb,
        instruction="",
        fabric_staves=("ooa_guitar", "ooa_bass_guitar"),
        improv_times=2,
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat=4 * 2,
        pitch_selectable_indices=((1, 3, 5, 6), ),
    )
    guitar_improv3 = improv.Improv(
        sb,
        instruction="",
        fabric_staves=("ooa_guitar", ),
        improv_times=2,
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat=8 * 2,
        pitch_selectable_indices=((0, 2, 4, 5), ),
    )
    s.extend_from(guitar_improv1, guitar_improv2, guitar_improv3)
    guitar_improv1.note_events[0].tag("fat fx")

    bass_line = lambda_segment.LambdaSegment(
        sb.with_only("bass_line", ),
        fabric_staves=("ooa_bass_guitar", ),
        func=lambda x: x.only_first("cells", 7).crop("cells", 1),
        tag_events={
            0: ("f", ),
        },
    )
    bass_line.cells[-1].t(12)
    piano_chords_rh = lambda_segment.LambdaSegment(
        sb.with_only("chords", ),
        fabric_staves=("piano1", ),
        # tag_all_note_events = ("-",),
        tag_events={
            0: ("f", ),
        },
        func=lambda x: x.with_only("cells", 0).crop_chords(above=(3, )),
    )
    piano_chords_lh = lambda_segment.LambdaSegment(
        sb.with_only("riff", ),
        fabric_staves=("piano2", ),
        tag_all_note_events=(".", ),
        func=lambda x: x.only_first("cells", 12).t(-24).e_smear_after(
            *[i * 2 for i in range(24)], extend_beats=0.5, cover_notes=True).
        crop_chords(indices=((0, 2), )),
    )

    string_chords = pad.Pad(
        sb.with_only("bass_drones"),
        fabric_staves=instrument_groups.get_instruments("cco_strings"),
        mask_staves=("cco_bass", ),
        ranges=pitch_ranges.LOW_TO_HIGH_RANGES,
        pad_durations=(10, 8, 6),
        tag_all_note_events=(":32", ),
        after_func=lambda x: x.eps(0, "pp", "\\<")(1, "mp")(2, "\\<")())
    s.extend_from(string_chords)

    # piano_chords_lh2 = lambda_segment.LambdaSegment(
    #     sb.with_only("chords",),
    #     fabric_staves=("piano2",),
    #     # tag_all_note_events = ("-",),
    #     func = lambda x: x.crop_chords(below=(3,)),
    #     )
    # for n in piano_chords_lh2.note_events:
    #     if sum(n.pitch) > 0:
    #         n.pitch = [p - 12 for p in n.pitch]

    trumpet_line1 = lambda_segment.LambdaSegment(
        sb.with_only(
            "mid_drones", ),  # TO DO... mid_drones not the best name for this
        fabric_staves=("cco_trumpet", ),
        func=lambda x: x.only_first("cells", 5).bookend_pad(0, 2),
        tag_events={
            0: ("mp", "solo", "\\<"),
            1: ("(", "f"),
            2: (")"),
            3: ("(", ),
            4: (")"),
        },
    )
    trumpet_line2 = lambda_segment.LambdaSegment(
        sb.with_only(
            "mid_drones", ),  # TO DO... mid_drones not the best name for this
        fabric_staves=("ooa_trumpet", ),
        func=lambda x: x.with_only("cells", 5, 6, 7, 8, 9).bookend_pad(10),
        tag_events={
            1: ("f", "solo"),
            2: ("(", ),
            3: (")"),
        },
    )
    trumpet_line3 = lambda_segment.LambdaSegment(
        sb.with_only(
            "mid_drones", ),  # TO DO... mid_drones not the best name for this
        fabric_staves=("cco_trumpet", ),
        func=lambda x: x.with_only("cells", 10, 11, 12, 13, 14).crop_chords(
            (0, )).bookend_pad(8),
        tag_events={
            2: ("(", ),
            3: (")"),
            4: ("(", ),
            5: (")"),
        },
    )

    s.extend_from(
        trumpet_line1,
        trumpet_line2,
        trumpet_line3,
        bass_line,
        piano_chords_rh,
        piano_chords_lh,
    )

    # =======================================================
    s.cells.apply(lambda x: x.auto_respell())

    riff_mallets1 = lambda_segment.LambdaSegment(
        sb.with_only("riff", ),
        fabric_staves=("ooa_mallets", ),
        func=lambda x: x.only_first("cells", 12).crop_chords(below=(2, 1)).
        crop_chords(above=(1, )),
        tag_events={0: ("f", )},
    )

    riff_harp1 = lambda_segment.LambdaSegment(
        sb.with_only("riff", ),
        fabric_staves=("harp1", ),
        func=lambda x: x.only_first("cells", 12).crop_chords(above=(-1, )),
        tag_events={0: ("f", )},
    )
    # creates downward line for each phrase:
    current_staff = "harp1"
    for p in riff_harp1.phrases:
        while p.note_events[0].pitch < 14:
            p.t(12)
        for n1, n2 in zip(p.note_events[0:-1], p.note_events[1:]):
            while n2.pitch > n1.pitch:
                n2.pitch -= 12
        #     if n2.pitch < 0 and current_staff=="harp1":
        #         n1.tag("""\\change Staff = "harp2" """)
        #         current_staff = "harp2"
        # if current_staff=="harp2":
        #     p.events[-1].tag("""\\change Staff = "harp1" """)
        #     current_staff = "harp1"

    s.extend_from(
        riff_mallets1,
        riff_harp1,
    )

    s.fill_rests(beats=6 * 4)

    # =======================================================
    # BARS 7+
    # =======================================================

    guitar_riff = lambda_segment.LambdaSegment(
        sb.with_only("riff", ),
        fabric_staves=("ooa_guitar", ),
        func=lambda x: x.with_only("cells", *list(range(12, 25))),
    )
    s.extend_from(guitar_riff)

    piano_osti = lambda_segment.LambdaSegment(
        sb.with_only("melody_line2", ),
        fabric_staves=("piano1", "piano2"),
        func=lambda x: x.with_only("cells", *list(range(1, 7))),
        funcs=(
            lambda x: x,
            lambda x: x.t(-12).eps(0, "treble")(),
        ),
        bookend_beats=(0, 2),
    )
    brass_osti = lambda_segment.LambdaSegment(
        sb.with_only("melody_line2", ),
        fabric_staves=instrument_groups.get_instruments("brass"),
        mask_staves=("cco_trumpet"),
        selectable_start_beat=6 * 4,
        assign_pitches_from_selectable=True,
        tag_all_note_events=("-", ),
        ranges=pitch_ranges.LOWISH_TO_HIGH_RANGES,
        bookend_beats=(4, 2),
        func=lambda x: x.with_only("cells", 3, 4, 5, 6).eps(0, "p", "\\<")
        (10, "mf")(0, 1, 5, 7, 9, "-")(2, 6, 10, ".")())

    string_chords2 = pad.Pad(
        sb.with_only("bass_drones", "mid_drones", "high_drones", "riff",
                     "bass_line"),
        fabric_staves=instrument_groups.get_instruments("strings"),
        mask_staves=("cco_bass", ),
        ranges=pitch_ranges.HIGHISH_TO_LOW_RANGES,
        pad_durations=(3, 1) * 8,
        tag_all_note_events=(":32", ),
        selectable_start_beat=6 * 4,
        after_func=lambda x: x.eps(0, "mf")())
    s.extend_from(string_chords2, extend_last_machine=True)

    fl_swells = staggered_swell.StaggeredSwells(
        sb.with_only("high_drones"),
        low_dynamic="mp",
        swell_dynamic="mf",
        cell_count=1,
        phrase_count=4,
        swell_duration=16,
        selectable_start_beat=6 * 4,
        # swell_split_ratios = (
        #     1/2,
        #     )
        swell_staggers=(
            (0, 2),
            (1, 1),
            # (0.5,0.5),
            # (1,0)
        ),
        fabric_staves=("cco_flute1", "cco_flute2"),
    )
    cl_dove_riff = dovetail.Dovetail(
        sb.with_only(
            "riff",
            "counter_line",
        ),
        fabric_staves=("ooa_alto_sax1", "ooa_alto_sax2", "ooa_tenor_sax",
                       "ooa_clarinet", "cco_clarinet1", "cco_clarinet2"),
        ranges=pitch_ranges.MID_RANGES,
        dove_count=3,
        selectable_start_beat=6 * 4,
        dovetail_duration=8 * 4,
        after_func=lambda x: x.slur_cells().ops("note_events")(0, "mf")())

    s.extend_from(piano_osti, cl_dove_riff, fl_swells, brass_osti)

    s.fill_rests(beats=10 * 4)
    # =======================================================
    # BARS 11+
    # =======================================================
    counter_line = lambda_segment.LambdaSegment(
        sb.with_only("counter_line", ),
        assign_pitches_from_selectable=True,
        selectable_start_beat=10 * 4,
        ranges=pitch_ranges.HIGHISH_TO_LOW_RANGES,
        fabric_staves=("ooa_bari_sax", "ooa_bassoon", "ooa_trombone",
                       "ooa_bass_guitar"),
        func=lambda x: cresc(
            bass_artics(x.with_only("cells", 1, 2, 3, 4, 5, 6, 7, 8).fuse())))
    s.extend_from(counter_line)

    flute_improv = improv.Improv(sb,
                                 fabric_staves=("ooa_flute", ),
                                 improv_times=4,
                                 ranges=pitch_ranges.HIGHISH_RANGES,
                                 selectable_start_beat=10 * 4,
                                 pitch_selectable_indices=((2, 4, 5, 6, 7), ),
                                 dynamic="mf")
    s.extend_from(flute_improv)

    s.fill_rests(beats=11 * 4)

    bass_to_end = lambda_segment.LambdaSegment(
        sb.with_only("bass_drones"),
        fabric_staves=("cco_bass", ),
        func=lambda x: x.crop("cells", 22, 1).crop_chords(below=(1, )).eps(
            0, "p", "\\<")(6, "mf")(21, "p")(29, "\\<")(36, "ff", beats=4)())
    s.extend_from(bass_to_end)

    s.fill_rests(beats=14 * 4)
    # =======================================================
    # BARS 15+
    # =======================================================

    guitar_fx = improv.Improv(
        instruction="crazy fat distorted sounds",
        assign_improv_pitches_from_selectable=False,
        fabric_staves=("ooa_guitar", ),
        after_func=lambda x: x.eps(0, "p", "\\<")(7, "f")(),
    )
    s.extend_from(guitar_fx)

    cloud_25_26 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c25_26"),
        fabric_staves=(
            "ooa_bassoon",
            "ooa_cello1",
            "ooa_cello2",
            "cco_oboe1",
            "cco_oboe2",
            "cco_bassoon",
        ),
        # tag_events = {0:("(",),3:(")",),4:("(",),7:(")",),8:("(",),11:(")",)},
        # tag_all_note_events = ("-",),
        func=lambda x: x.eps(0, "mp", "\\<")(23, "f")(),
    )

    for seg in cloud_25_26.segments:
        for i, n in enumerate(seg.note_events):
            if i % 2 == 0:
                n.tag("(")
            else:
                n.tag(")")
    s.extend_from(cloud_25_26, )
    s.fill_rests(beats=15.5 * 4,
                 only_staves=("ooa_alto_sax1", "ooa_alto_sax2",
                              "ooa_tenor_sax", "ooa_bari_sax", "ooa_violin1",
                              "ooa_violin2"))

    cloud_27_28 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c27_28"),
        fabric_staves=instrument_groups.get_instruments("sax", "ooa_strings") +
        (
            "ooa_bassoon",
            "cco_oboe1",
            "cco_oboe2",
            "cco_bassoon",
        ),
        # tag_events = {0:("(",),3:(")",),4:("(",),7:(")",),8:("(",),11:(")",)},
        # tag_all_note_events = ("-",),
        func=lambda x: x.eps(0, "mp", "\\<")(15, "f")(),
    )
    for seg in cloud_27_28.segments:
        for i, n in enumerate(seg.note_events):
            if i % 2 == 0:
                n.tag("(")
            else:
                n.tag(")")
    s.extend_from(cloud_27_28, extend_last_machine=True)

    hit_staves = s.unused_staves_at_beat(14 * 4)
    hit_mask_staves = ("ooa_mallets", "ooa_drum_set", "ooa_guitar",
                       "ooa_bass_guitar", "cco_percussion", "piano1", "piano2",
                       "harp1", "harp2")
    opening_hit = hits.Hits(
        sb,
        fabric_staves=hit_staves,
        mask_staves=hit_mask_staves,
        ranges=pitch_ranges.BOTTOM_RANGES,
        selectable_start_beat=14 * 4,
        hits_spacing=(4, ),
        hit_duration=1,
        tag_all_note_events=(">", "."),
    )
    then_swell_hit = swell_hit.SwellHit(
        sb,
        fabric_staves=hit_staves,
        mask_staves=hit_mask_staves,
        ranges=pitch_ranges.MID_TO_HIGHISH_RANGES,
        selectable_start_beat=15 * 4,
        low_dynamic="p",
        hit_dynamic="f",
        swell_duration=7.5,
        hit_duration=0.5,
        hit_rest=0,
        hit_articulations=(".", ">"))

    s.extend_from(opening_hit, then_swell_hit)

    s.fill_rests(beats=17 * 4)
    # =======================================================
    bass_guitar_riff = lambda_segment.LambdaSegment(
        sb.with_only("riff", ),
        fabric_staves=("ooa_bass_guitar", ),
        func=lambda x: x.with_only("cells", *list(range(29, 36))).t(-24).eps(
            0, "mf")(),
    )
    s.extend_from(bass_guitar_riff)

    dove_riff2 = dovetail.Dovetail(
        sb.with_only(
            "riff",
            "counter_line",
        ),
        fabric_staves=(
            "ooa_tenor_sax",
            "ooa_clarinet",
            "ooa_bari_sax",
            "ooa_bassoon",
            "ooa_alto_sax1",
            "ooa_alto_sax2",
            "ooa_flute",
        ),
        ranges=pitch_ranges.HIGHISH_RANGES,
        dove_count=3,
        selectable_start_beat=17 * 4,
        dovetail_duration=4.5 * 4,
        after_func=lambda x: x.slur_cells().ops("note_events")(0, "mf")())
    counter_line2 = lambda_segment.LambdaSegment(
        sb.with_only("counter_line", ),
        assign_pitches_from_selectable=True,
        selectable_start_beat=17 * 4,
        ranges=pitch_ranges.HIGHISH_TO_LOW_RANGES,
        fabric_staves=instrument_groups.get_instruments(
            "cco_winds", "cco_brass"),
        mask_staves=("cco_flute1", "cco_flute2"),
        func=lambda x: cresc(
            bass_artics(
                x.with_only("cells", *list(range(10, 18))).transformed(
                    calliope.StandardDurations()))),
    )
    counter_line_mallets = lambda_segment.LambdaSegment(
        sb.with_only("counter_line", ),
        fabric_staves=("ooa_mallets", ),
        # bookend_beats=(0,2),
        func=lambda x: x.with_only("cells", *list(range(10, 18))).eps(1, "f")
        (),
    )
    piano_osti2 = lambda_segment.LambdaSegment(
        sb.with_only("melody_line2", ),
        fabric_staves=("piano1", "piano2"),
        func=lambda x: x.with_only("cells", *list(range(8, 12))),
        funcs=(
            lambda x: x,
            lambda x: x.t(-12).eps(0, "bass")(5, "treble")(),
        ),
        bookend_beats=(0, 1),
    )

    brass_osti2 = lambda_segment.LambdaSegment(
        sb.with_only("melody_line2", ),
        fabric_staves=instrument_groups.get_instruments("ooa_brass"),
        selectable_start_beat=17 * 4,
        assign_pitches_from_selectable=True,
        ranges=pitch_ranges.LOWISH_TO_HIGH_RANGES,
        bookend_beats=(0, 1),
        func=lambda x: x.with_only("cells", *list(range(8, 12))).eps(
            0, "p", "\\<")(10, "mf")(0, 1, 5, 7, 9, "-")(2, 6, 10, ".")())

    s.extend_from(dove_riff2, counter_line2, piano_osti2, brass_osti2,
                  counter_line_mallets)

    s.fill_rests(beats=22 * 4)
    # # =======================================================
    # # BARS 23+
    # # =======================================================
    # END FULL PADS:
    rolls = pad.Pad(
        sb.with_only("high_drones"),
        ranges=pitch_ranges.TOP_RANGES,
        selectable_start_beat=22 * 4,
        fabric_staves=(
            "ooa_mallets",
            "piano1",
            "piano2",
            "harp1",
        ),
        pad_durations=(4, ) * 8,
        tag_all_note_events=(":32", ),
        after_func=lambda x: x.eps(0, "p")(3, "\\<")(7, "ff")(),
    )
    rolls.staves["piano1"].segments[0].note_events[0].tag("8va")
    rolls.staves["piano1"].segments[0].note_events[-1].tag("8va!")
    rolls.staves["piano1"].segments[0].stack_p([(0, 12)])
    rolls.staves["piano2"].segments[0].stack_p([
        (-12, -24)
    ]).crop("cells", 0).bookend_pad(4, 0)
    rolls.staves["piano2"].events.untag("p", "ff", "\\<")

    s.extend_from(rolls)

    # END CLOUD:

    cloud_37_39 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c37_39"),
        fabric_staves=("ooa_clarinet", "ooa_violin1", "ooa_violin2",
                       "cco_clarinet1", "cco_clarinet2", "cco_viola"),
        # tag_events = {0:("(",),3:(")",),4:("(",),7:(")",),8:("(",),11:(")",)},
        # tag_all_note_events = ("-",),
        func=lambda x: cresc(x.fuse(), "p", "mf").bookend_pad(3),
        funcs=(
            lambda x: x.slur_cells(),
            lambda x: x.eps(1, 3, 6, 8, 10, 13, "(")(2, 5, 7, 9, 11, 14, ")")
            (),
            lambda x: x.eps(1, 4, 9, 11, 13, "(")(3, 6, 10, 12, 14, ")")(),
            lambda x: x.slur_cells(),
            lambda x: x.slur_cells(),
            lambda x: x.eps(1, 5, 8, 11, 13, "(")(3, 7, 9, 12, 14, ")")(),
        ))

    cloud_38_40 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c38_40"),
        fabric_staves=("ooa_bari_sax", "ooa_bassoon", "ooa_cello1",
                       "ooa_cello2", "cco_bassoon", "cco_cello"),
        func=lambda x: cresc(x.fuse(), "mp", "mf").bookend_pad(6),
        funcs=(
            lambda x: x.slur_cells(),
            lambda x: x.slur_cells(),
            lambda x: x,
            lambda x: x,
            lambda x: x.slur_cells(),
            lambda x: x,
        ))

    cloud_39_41 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c39_41"),
        fabric_staves=("cco_flute1", "cco_flute2", "cco_oboe1", "cco_oboe2",
                       "cco_violin_i", "cco_violin_ii"),
        func=lambda x: cresc(x.fuse(), "mp", "f").bookend_pad(9),
        funcs=(
            lambda x: x.slur_cells(),
            lambda x: x.slur_cells(),
            lambda x: x.slur_cells(),
            lambda x: x.slur_cells(),
            lambda x: x,
            lambda x: x,
        ))
    s.extend_from(cloud_37_39,
                  cloud_38_40,
                  cloud_39_41,
                  extend_last_machine=True)
    s.fill_rests(beats=25 * 4)

    guitar_fx2 = improv.Improv(
        instruction="crazy fat distorted sounds",
        assign_improv_pitches_from_selectable=False,
        improv_rhythm=(1, ) * (4 * 4 + 2),
        fabric_staves=(
            "ooa_guitar",
            "ooa_bass_guitar",
        ),
        after_func=lambda x: x.mask("events", 18, 19).eps(0, "mp", "\\<")
        (17, "f")(),
    )
    s.extend_from(guitar_fx2)

    cloud_40_42 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c40_42"),
        fabric_staves=("ooa_trombone", "ooa_violin1", "ooa_violin2",
                       "cco_horn", "cco_trombone", "cco_viola"),
        func=lambda x: cresc(x.fuse(), "mp", "f"),
        funcs=(
            lambda x: x.slur_cells(),
            lambda x: x,
            lambda x: x,
            lambda x: x.slur_cells(),
            lambda x: x.slur_cells(),
            lambda x: x,
        ))
    s.extend_from(cloud_40_42, extend_last_machine=True)
    s.fill_rests(beats=25 * 4 + 3)

    cloud_41_43 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c41_43"),
        fabric_staves=("ooa_clarinet", "cco_clarinet1", "cco_clarinet2",
                       "ooa_cello1", "ooa_cello2", "cco_cello"),
        func=lambda x: cresc(x.fuse(), "mf", "f"),
        funcs=(
            lambda x: x.slur_cells(),
            lambda x: x.slur_cells(),
            lambda x: x.slur_cells(),
            lambda x: x,
            lambda x: x,
            lambda x: x,
        ))
    s.extend_from(
        cloud_41_43,
        extend_last_machine=True,
    )
    s.fill_rests(beats=26 * 4 + 2)

    # glisses
    s.extend_from(
        lambda_segment.LambdaSegment(gliss_up_block(-2, 2, 10),
                                     fabric_staves=("cco_violin_i",
                                                    "cco_violin_ii")),
        extend_last_machine=True,
    )

    cloud_42_45 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c42_45"),
        fabric_staves=(
            "ooa_alto_sax1",
            "ooa_alto_sax2",
            "ooa_tenor_sax",
            "ooa_bari_sax",
            "ooa_bassoon",
            "cco_bassoon",
        ),
        func=lambda x: cresc(x.fuse(), "mf", "ff").slur_cells(),
    )
    s.extend_from(
        cloud_42_45,
        extend_last_machine=True,
    )
    s.fill_rests(beats=27 * 4 + 1)

    cloud_43_45 = lambda_segment.LambdaSegment(
        lib("rock_grid_g4_c43_45"),
        fabric_staves=("ooa_flute", "ooa_horn", "ooa_trumpet", "cco_oboe1",
                       "cco_oboe2", "cco_trumpet"),
        func=lambda x: cresc(x.fuse(), "mf", "ff").slur_cells(),
    )
    s.extend_from(
        cloud_43_45,
        extend_last_machine=True,
    )

    # glisses
    s.extend_from(
        lambda_segment.LambdaSegment(gliss_up_block(-1, 2, 6),
                                     fabric_staves=("ooa_violin1",
                                                    "ooa_violin2",
                                                    "cco_viola"),
                                     after_funcs=(
                                         lambda x: x,
                                         lambda x: x,
                                         lambda x: x.t(-12),
                                     )),
        extend_last_machine=True,
    )

    s.fill_rests(beats=28)
    # glisses
    s.extend_from(
        lambda_segment.LambdaSegment(gliss_up_block(-2, 2, 2, -12,
                                                    ("tenor", )),
                                     fabric_staves=("ooa_cello1", "ooa_cello2",
                                                    "cco_cello")),
        extend_last_machine=True,
    )

    s.fill_rests(beats=31 * 4)
    s.fill_rests(beats=32 * 4)
    for st in s.staves:
        st.events[-1].tag("fermata")

    # =======================================================

    # adjust for bass 8va
    for bass_seg in s.staves["cco_bass"].segments:
        bass_seg.transformed(calliope.Transpose(interval=12))

    s.fill_rests()
    s.remove(s.staff_groups["short_score"])
    # s.only_staves("harp1", "harp2", "piano1", "piano2")

    s.lines.apply(lambda x: x.auto_respell())
    s.phrases.apply(lambda x: x.auto_respell())

    for staff in s.staves:
        # staff.phrases.transformed(calliope.Label())
        # staff.lines.transformed(calliope.Label())

        # TO DO: WHY DOESN'T THIS WORK?????
        if segs := staff.segments:
            main_seg = segs[0]
            for next_seg in list(segs[1:]):
                main_seg.extend(next_seg)
                next_seg.parent.remove(next_seg)
            main_seg.rehearsal_mark_number = 9
            main_seg.compress_full_bar_rests = True
Ejemplo n.º 4
0
s = score.ImaginaryScore()

# TO DO: add ranges
# =======================================================
# bars 1-8

strings_pulse1 = pulse.Pulse(
    fabric_staves=("ooa_violin1", "ooa_violin2", "ooa_cello1", "ooa_cello2",
                   "cco_violin_i", "cco_violin_ii", "cco_viola"),
    pulse_beats=26,
)

strings_swell1 = swell_hit.SwellHit(
    fabric_staves=("ooa_violin1", "ooa_violin2", "ooa_cello1", "ooa_cello2",
                   "cco_violin_i", "cco_violin_ii", "cco_viola"),
    swell_duration=5.5,
    hit_rest=0,
)

strings_low_pulse1 = pulse.Pulse(
    fabric_staves=("cco_cello", "cco_bass"),
    pulse_duration=1,
    pulse_beats=29,
)

counter_winds = ditto.Ditto(calliope.LineBlock(
    COUNTER_LINE_1(),
    COUNTER_LINE_2(),
),
                            fabric_staves=("ooa_flute", "ooa_clarinet",
                                           "cco_flute1", "cco_flute2",
Ejemplo n.º 5
0
def score5(lib):
    s = score.ImaginaryScore()
    sb = lib("integrate_block5")
    s = sb().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s)

    strings_pulse1 = pulse.Pulse(
        sb,
        fabric_staves=("ooa_violin1", "ooa_violin2", "ooa_cello1",
                       "ooa_cello2", "cco_violin_i", "cco_violin_ii",
                       "cco_viola"),
        pulse_beats=26,
        tag_all_note_events=(".", ),
    )

    strings_swell1 = swell_hit.SwellHit(
        sb,
        fabric_staves=("ooa_violin1", "ooa_violin2", "ooa_cello1",
                       "ooa_cello2", "cco_violin_i", "cco_violin_ii",
                       "cco_viola"),
        swell_duration=5.5,
        hit_rest=0,
    )

    low_pulse1 = pulse.Pulse(
        sb.with_only("bass_drones"),
        fabric_staves=("ooa_bass_guitar", "ooa_guitar", "cco_cello",
                       "cco_bass"),
        pulse_duration=1,
        pulse_beats=29,
        bookend_beats=(0, 3),
    )
    low_pulse1.staves["cco_cello", "cco_bass"].note_events.tag(".")

    sax_melody = lambda_segment.LambdaSegments(
        sb.with_only("mid_drones"),
        fabric_staves=("ooa_alto_sax1", "ooa_alto_sax2", "ooa_tenor_sax"),
        # bookend_beats=(0,0),
        funcs=(
            lambda x: x.slur_cells().eps(1, "mf")(),
            lambda x: x.slur_cells().eps(1, "mf")(),
            lambda x: x.slur_cells().t(-12).eps(1, "mf")(),
        ),
    )
    srings_fast = osti.Osti(
        sb,
        fabric_staves=instrument_groups.get_instruments("strings"),
        ranges=pitch_ranges.LOW_TO_HIGH_RANGES,
        selectable_start_beat=8 * 4,
        osti_pulse_duration=0.25,
        osti_cell_length=16,
        osti_cell_count=8,
    )
    vibraphone_riff = lambda_segment.LambdaSegment(
        sb.with_only("riff"),
        fabric_staves=("ooa_mallets", ),
        func=lambda x: x,
    )

    s.extend_from(strings_pulse1, )
    s.extend_from(
        strings_swell1(),
        extend_last_machine=True,
    )
    s.extend_from(low_pulse1, )
    s.extend_from(
        # counter_winds(),
        # strings_pulse1,
        # strings_low_pulse1,
        sax_melody,
        vibraphone_riff,
        # osti1,
        # driving_sax,
        # my_melody,
        # melody_accents,
        # bass_line,
    )
    s.extend_from(srings_fast)

    # s.extend_from(
    #     strings_swell1(),
    #     extend_last_machine=True,
    #     )

    # TO DO: consider bringing some of this back
    # counter_winds = ditto.Ditto(
    #     calliope.LineBlock(
    #         COUNTER_LINE_1(),
    #         COUNTER_LINE_2(),
    #         ),
    #     fabric_staves = ("ooa_flute", "ooa_clarinet",
    #         "cco_flute1", "cco_flute2",
    #         "cco_clarinet1", "cco_clarinet2")
    #     )

    # osti_lb = rock.OstiLineBlock(
    #     phrase_count=7,
    #     cuts = (
    #         dict(crop=(0,6)),
    #         dict(crop=(0,6)),
    #         dict(crop=(0,6)),
    #         dict(crop=(2,0)),
    #         ),
    #     slur_cells = True,
    #     )

    # osti1 = ditto.Ditto(osti_lb,
    #     fabric_staves = ("ooa_bassoon", "cco_oboe1", "cco_oboe2", "cco_bassoon")
    #     )

    # osti1_accents = hit_cells.HitCells(osti_lb,
    #     fabric_staves = instrument_groups.get_instruments("sax"),
    #     mask_staves = ("ooa_bari_sax"),
    #     )

    # TO DO: move to lyrical section
    # melody_lb = calliope.LineBlock(
    #         HOME_LINE(),
    #         )

    # my_melody = melody.Melody(melody_lb,
    #     fabric_staves = ("ooa_trumpet", "cco_trumpet"),
    #     )

    # TO DO: this doesn't work right... why?
    # melody_accents = (hit_cells.HitCells(
    #     melody_lb,
    #     fabric_staves = ("ooa_horn", "cco_horn"),
    #     hit_duration = 0.5,
    #     )
    #     )
    # melody_accents = melody.Melody(melody_lb,
    #     fabric_staves = ("ooa_horn", "cco_horn"),
    #     )

    # # TO DO... move this into integration
    # driving_sax = driving_off.DrivingOff(
    #     fabric_staves = instrument_groups.get_instruments("sax",),
    #     mask_staves = ("ooa_bari_sax"),
    #     bookend_beats = (0,1),
    #     )

    # bass_line = melody.Melody(
    #     calliope.LineBlock(
    #         calliope.Line(*BASS_LINE()[:-1]),
    #         ),
    #     fabric_staves = ("ooa_trombone", "ooa_bass_guitar", "ooa_bari_sax", "cco_trombone", ),
    #     )

    # s.extend_from(
    #     counter_winds(),
    #     strings_pulse1(),
    #     strings_low_pulse1,
    #     osti1,
    #     driving_sax,
    #     my_melody,
    #     melody_accents,
    #     bass_line,
    #     )
    # s.extend_from(
    #     strings_swell1(),
    #     extend_last_machine=True,
    #     )

    # s.fill_rests(fill_to="cco_violin_i")

    # # =======================================================
    # # bars 9-16

    # s.extend_from(
    #     counter_winds(),
    #     osti1,
    #     osti1_accents,
    #     strings_pulse1(),
    #     strings_low_pulse1(),
    #     )
    s.fill_rests()
    s.midi_tempo = 112
    return s
Ejemplo n.º 6
0
s = score.ImaginaryScore()

# TO DO: add ranges
# =======================================================
# bars 1-8

strings_pulse1 = pulse.Pulse(
    fabric_staves=("ooa_violin1", "ooa_violin2", "ooa_cello1", "ooa_cello2",
                   "cco_violin_i", "cco_violin_ii", "cco_viola"),
    pulse_beats=26,
)

strings_swell1 = swell_hit.SwellHit(
    fabric_staves=("ooa_violin1", "ooa_violin2", "ooa_cello1", "ooa_cello2",
                   "cco_violin_i", "cco_violin_ii", "cco_viola"),
    swell_duration=5.5,
    hit_rest=0,
)

strings_low_pulse1 = pulse.Pulse(
    fabric_staves=("cco_cello", "cco_bass"),
    pulse_duration=1,
    pulse_beats=29,
)

counter_winds = ditto.Ditto(calliope.LineBlock(
    COUNTER_LINE_1(),
    COUNTER_LINE_2(),
),
                            fabric_staves=("ooa_flute", "ooa_clarinet",
                                           "cco_flute1", "cco_flute2",
Ejemplo n.º 7
0
            )
sax_guitar_osti = ditto.Ditto(lb1,
    fabric_staves = ("ooa_alto_sax1", "ooa_alto_sax2", "ooa_guitar")
    )

# TO DO: copy pitches from osti
winds_doves = dovetail.Dovetail(
    dove_event_count = 6,
    dovetail_duration = 10*4,
    fabric_staves = ("cco_flute1", "cco_flute2",
        "cco_oboe1", "cco_oboe2", 
        "cco_clarinet1", "cco_clarinet2")
    )

bassoon_swell = swell_hit.SwellHit(
    swell_duration = 3,
    hit_rest = 
    )

s.extend_from(
    my_low_melody,
    off_strings,
    sax_guitar_osti,
    )
s.fill_rests(fill_to="ooa_alto_sax1")
s.extend_from(winds_doves)


s.fill_rests(fill_to="cco_violin_i")

# =======================================================
# bars 9-16
Ejemplo n.º 8
0
    #     ),
    # swell_staggers = (
    #         (0,1),
    #         (0.5,0.5),
    #         (1,0)
    #     ),
)
x = staggered_swell.StaggeredSwells(
    sb,
    fabric_staves=instrument_groups.get_instruments("cco_winds"),
    # cell_count=2,
    # phrase_count=2,
)
# calliope.illustrate(x)

# ======================================================================
# SWELL HIT
x = swell_hit.SwellHit(
    sb,
    fabric_staves=instrument_groups.get_instruments("brass"),
    # ranges=pitch_ranges.MID_RANGES,
    # selectable_start_beat = 0,
    # low_dynamic = "p",
    # hit_dynamic = "f",
    # swell_duration = 4,
    # hit_duration = 0.5,
    # hit_rest = 3.5,
    # hit_articulations = (".",)
)
# calliope.illustrate(x)