예제 #1
0
def grid_g4_c38_40(lib):
    return lib("rock_block4").get_grid_a(
        "rock_g4_c38_40",
        cells=(38, 39, 40),
        pitch_ranges=pitch_ranges.PitchRanges(valley_seq()),
        pitch_ranges_instruments=("ooa_bari_sax", "ooa_bassoon", "ooa_cello1",
                                  "ooa_cello2", "cco_bassoon", "cco_cello"),
        tallies=tally_apps.LINE_SMOOTH_2_REPEATS_PREFER,
        output_directory=output_directory,
    )
예제 #2
0
def grid_g4_c42_45(lib):
    return lib("rock_block4").get_grid_a(
        "rock_g4_c42_45",
        cells=(42, 43, 44, 45),
        pitch_ranges=pitch_ranges.PitchRanges(valley_seq()),
        pitch_ranges_instruments=(
            "ooa_alto_sax1",
            "ooa_alto_sax2",
            "ooa_tenor_sax",
            "ooa_bari_sax",
            "ooa_bassoon",
            "cco_bassoon",
        ),
        tallies=tally_apps.LINE_SMOOTH_2_REPEATS_PREFER,
        output_directory=output_directory,
    )
예제 #3
0
def grid_g4_c41_43(lib):
    return lib("rock_block4").get_grid_a(
        "rock_g4_c41_43",
        cells=(41, 42, 43),
        pitch_ranges=pitch_ranges.PitchRanges(valley_seq()),
        pitch_ranges_instruments=(
            "ooa_clarinet",
            "cco_clarinet1",
            "cco_clarinet2",
            "ooa_cello1",
            "ooa_cello2",
            "cco_cello",
        ),
        tallies=tally_apps.LINE_SMOOTH_2_REPEATS_PREFER,
        output_directory=output_directory,
    )
예제 #4
0
def score1(lib):
    s = score.ImaginaryScore()
    sb = lib("rock_block1")
    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,
        )

    # TO DO: consider poking apart the clouds a little bit

    # # TO DO: add ranges
    # # =======================================================
    # WOOD BLOCK, BASS, PIZZ THORUGHOUT
    wood_block = lambda_segment.LambdaSegment(
        sb.with_only("high_rhythm"),
        fabric_staves = ("cco_percussion",),
        # tag_events = {0:("mp", "woodblock")},
        func = lambda x: x,
        # func = lambda x: x.only_first("cells",8)
        )   
    wood_block.note_events.setattrs(pitch=0)
    # TO DO... consider varying this up... so not always
    # bass on double stop
    bass_drones =  lambda_segment.LambdaSegment(
        sb.with_only("bass_drones"),
        # selectable_start_beat = (23*4),
        fabric_staves = (
            "ooa_bass_guitar",
            "cco_bass",
            ),
        func = lambda x: x.t(12),
        # tag_events = {0:("mf",)},
        )

    opening_wind_hits = lambda_segment.LambdaSegment(
        sb.with_only("chords"),
        ranges=pitch_ranges.MID_RANGES,
        fabric_staves = instrument_groups.get_instruments(
            "sax","ooa_winds","ooa_brass"),
        assign_pitches_from_selectable = True,
        func = lambda x: x.only_first("cells",1).bookend_pad(0,1),
        tag_all_note_events=(".",)
        )

    opening_pizz = lambda_segment.LambdaSegment(
        sb.with_only("chords"),
        ranges=pitch_ranges.BOTTOM_RANGES,
        fabric_staves = instrument_groups.get_instruments(
            "strings"),
        mask_staves = ("cco_bass",),
        # tag_events = {0:("mf", "pizz")},
        assign_pitches_from_selectable = True,
        func = lambda x: x.only_first("cells",7
            ).bookend_pad(0,3).eps(
            0, "!\\snappizzicato")(),
        )

    s.extend_from(
        wood_block,
        bass_drones,
        opening_wind_hits,
        opening_pizz,
        )
    # # =======================================================
    # OPENING RIFFS ON GUITAR, HARP, MALLETS

    mallets_riff = lambda_segment.LambdaSegment(
        sb.with_only("riff",),
        fabric_staves = (
            "ooa_mallets",
            ),
        tag_events = {0:("mf", "hard mallets")},
        func = lambda x: x,
        )

    poke_mallets = []
    next_include = False
    for i,e in enumerate(mallets_riff.events):   
        e_pitch = e.pitch
        if len(e_pitch)>1 and abs(e_pitch[0]-e_pitch[1])==12:
            next_include = True
            poke_mallets.append(i)
        elif next_include:
            poke_mallets.append(i)
            next_include = False
        else:
            next_include = False
    mallets_riff.segments[0].poke("events", *poke_mallets)
    mallets_riff.note_events[-4:].transformed(calliope.Transpose(interval=-12))

    riffs_opening = lambda_segment.LambdaSegments(
        riffs_block,
        fabric_staves = (
            "ooa_guitar",
            "harp1",
            ),
        # tag_events = {0:("mf", "hard mallets")},
        funcs = (
            lambda x: x.only_first("cells", 8
                ).crop_chords(indices=(1,)).t(-12
                ).bookend_pad(0,1),
            lambda x: x.only_first("cells", 8
                ).crop_chords(indices=(0,)
                ).bookend_pad(0,1),
                )
        )

    s.extend_from(
        mallets_riff,
        riffs_opening,
        )


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

    cymbals = lambda_segment.LambdaSegment(
        sb.with_only("high_rhythm"),
        fabric_staves = ("ooa_drum_set",),
        func = lambda x: x.only_first("cells",6).eps(
            0, "improv, cymbals", "mp")(),
        tag_all_note_events = ("note_head:0:slash",)
        )  
    cymbals.note_events.setattrs(pitch=0)
    s.extend_from(cymbals,)

    s.extend_from(
        lambda_segment.LambdaSegment(
            calliope.SegmentBlock(ImaginarySegment(
                lib("rock_rhythm1"),
                get_improv_line(
                    rhythm=(1,)*8,
                    times=6
                    ),
                get_improv_line(
                    rhythm=(0.5,)*16,
                    times=1,
                    instruction="improv, solo"
                    ),
            )),
            fabric_staves = ("ooa_drum_set",),
            func = lambda x: x,
            )
        )

    osti_chords_piano = lambda_segment.LambdaSegments(
        sb.with_only("melody_line2"),
        fabric_staves = ("piano1","piano2"),
        func = lambda x: x.crop_chords(above=(3,)).only_first("cells",7),
        funcs = (
            lambda x: x.ops("note_events")(
                0,"f")(),
            lambda x: x.t(-12).ops("note_events")(
                0,"treble")(),
            )
        )
    # osti_chords_piano.staves["piano2"].note_events[0].tag("treble")
    s.extend_from(osti_chords_piano,)

    s.fill_rests(beats=8)

    osti_chords_brass = lambda_segment.LambdaSegment(
        sb.with_only("melody_line2"),
        fabric_staves = instrument_groups.get_instruments("brass",),
        func = lambda x:x.only_first("cells",7
            ).crop("events",4).poke("note_events",0,3,4,7,8,9
            ).ops("events")(0,"mf")(),
        tag_all_note_events=("-",),
        assign_pitches_from_selectable=True,
        selectable_start_beat=8,
        ranges=pitch_ranges.MID_RANGES,
        )

    s.extend_from(osti_chords_brass,)

    s.fill_rests(beats=4*4)
    # # =======================================================
    cloud_6 = lib("rock_grid_g1_c6")
    # cloud_11[3].t(12)
    wind_cloud_6 = lambda_segment.LambdaSegment(
        cloud_6,
        fabric_staves = (
            "cco_flute1",
            "ooa_clarinet",
            "ooa_flute",
            "cco_clarinet1",
            "cco_flute2",
            "cco_clarinet2",
            ),
        tag_events = {1:("mp", "\\<",), 6:("mf",)},
        # assign_pitches_from_selectable = True,
        # selectable_start_beat = 16*4,
        func = lambda x: x.slur_cells().bookend_pad(2,3),
        # func = lambda x: x.crop("cells",1),
        # func = lambda x: x.only_first("cells",8)
        )
    wind_cloud_6.phrases.setattrs(respell="flats")
    wind_cloud_6.staves["ooa_flute"].phrases.setattrs(respell="sharps")
    s.extend_from(
        wind_cloud_6,
        )
    s.fill_rests(fill_to="cco_flute1")

    # # =======================================================
    # FROM BAR 7

    mid_pads = lambda_segment.LambdaSegments(
        sb.with_only("mid_drones",),
        fabric_staves = (
            "ooa_guitar",
            "cco_viola",
            ),
        funcs = (
            lambda x: x.crop("cells",1).eps(
                0,"distorted, spacey","mf")(),
            lambda x: x.crop("cells",1).eps(
                0, "mf","arco","sul pont")(),
            )
        )

    brass_swells = staggered_swell.StaggeredSwells(
        sb.with_only("mid_drones"),
        low_dynamic = "p",
        swell_dynamic = "mf",
        cell_count = 1,
        phrase_count=8,
        swell_duration = 8,
        selectable_start_beat=6*4,
        # swell_split_ratios = (
        #     1/2,
        #     )
        swell_staggers = (
                (0,2),
                (1,1),
                # (0.5,0.5),
                # (1,0)
            ),
        fabric_staves = (
            "ooa_horn", "cco_horn","ooa_trumpet", "cco_trumpet"
            ),
        )
    for st in brass_swells.staves["ooa_trumpet", "cco_trumpet"]:
        st.note_events[0].tag("straight mute")
    # for c in horn_swells.cells:
    #     c.events[-1].tag("\\!")

    # # =======================================================
    # continue riff... TO DO, are violins the best option here?
    # # =======================================================
    # TO DO: consider merging into single staff
    # TO DO: ooa violin fx??????!!
    ooa_violins = lambda_segment.LambdaSegment(
        sb.with_only("riff"),
        assign_pitches_from_selectable = True,
        ranges=pitch_ranges.LOW_TO_HIGHISH_RANGES,
        fabric_staves = (
            "ooa_violin1",
            "ooa_violin2",
            ),
        # tag_events = {0:("mf", "hard mallets")},
        tag_all_note_events = ("-",),
        selectable_start_beat=6*4,
        func = lambda x: x.with_only("cells", 8,9,10,11,12,13,14,15,16
                ).crop("events",2).eps(
                0, "arco")()
              # ).bookend_pad(0,1)

        )
    s.extend_from(
        mid_pads,
        brass_swells,
        ooa_violins,
        )
    # # =======================================================
    # BAR 13 +:
    # cco flutes high E drones
    # closing string pizz
    # cco clarinets and oboes trade off riff
    # # =======================================================
    # TO DO: check this flute range with dynamics... consider piccolo
    s.fill_rests(beats=12*4)
    # TO DO: consider modeling this with flutes... DRY
    flute_high_swells = staggered_swell.StaggeredSwells(
        sb.with_only("high_drones"),
        low_dynamic = "p",
        swell_dynamic = "mf",
        cell_count = 1,
        phrase_count=4,
        swell_duration = 8,
        selectable_start_beat=12*4,
        # swell_split_ratios = (
        #     1/2,
        #     )
        swell_staggers = (
                (0,2),
                (1,1),
                # (0.5,0.5),
                # (1,0)
            ),
        fabric_staves = (
            "cco_flute1", "cco_flute2"
            ),
        )
    closing_pizz = lambda_segment.LambdaSegment(
        sb.with_only("chords"),
        ranges=pitch_ranges.HILL_UP_RANGES,
        fabric_staves = instrument_groups.get_instruments(
            "cco_strings") + ("ooa_cello1","ooa_cello2"),
        mask_staves = ("cco_bass", "cco_viola"),
        selectable_start_beat=12*4,
        tag_events = {0:("mf", "pizz")},
        assign_pitches_from_selectable = True,
        func = lambda x: x.crop("cells",17),
        # func = lambda x: x.crop("cells",1),
        # func = lambda x: x.only_first("cells",8)
        )
    midpoint_wind_hit = lambda_segment.LambdaSegment(
        sb.with_only("chords"),
        ranges=pitch_ranges.MID_RANGES,
        fabric_staves = instrument_groups.get_instruments(
            "sax","ooa_winds") + ("ooa_trombone",),
        assign_pitches_from_selectable = True,
        selectable_start_beat=12*4,
        func = lambda x: x.with_only("cells",17).bookend_pad(0,2),
        tag_all_note_events=(".",)
        )
    
    ob_cl_dove_riff = dovetail.Dovetail(
        sb.with_only("riff"),
        fabric_staves=("cco_oboe1","cco_oboe2","cco_clarinet1","cco_clarinet2"),
        ranges=pitch_ranges.LOW_TO_HIGH_RANGES,
        # tag_events = {0:("THIS CLOUD SUCKS",)},
        tag_all_note_events = ("-",),
        selectable_start_beat=12*4,
        dovetail_duration = 28,
        )
    piano_riff = lambda_segment.LambdaSegment(
        sb.with_only("riff"),
        fabric_staves=("piano1","piano2",),
        ranges=pitch_ranges.PitchRanges(pitch_ranges.RangeSeq().add_abstract(
            0, pitch_ranges.TOP_RANGE,
            ).add_abstract(
            0.5, pitch_ranges.MID_RANGE,
            ).add_abstract(
            1, pitch_ranges.TOP_RANGE,
            ),),
        assign_pitches_from_selectable=True,
        selectable_start_beat=12*4,
        tag_all_note_events = (".",),
        func = lambda x: x.crop("cells", 17),
        )
    piano_riff.staves["piano1"].note_events[-5:].transformed(
        calliope.Transpose(interval=12))
    piano_riff.staves["piano1"].note_events[28,29,30].transformed(
        calliope.Transpose(interval=12))
    piano_riff.staves["piano2"].note_events[6,7,8,9,10,11,
        22,23,24,25,28,30,31,32,33,34,35,36,].transformed(
        calliope.Transpose(interval=-12))
    piano_riff.staves["piano1"].segments[0].eps(
        0,48,"8va")(
        5,55,"8va!")()
    piano_riff.staves["piano2"].segments[0].t(-12).eps(
        18, "bass",)(
        40, "treble")()
    # NOT NEEDED SINCE ALREADY TREBLE
    # piano_riff.staves["piano2"].events[0].tag("treble")
    # ob_cl_dove_riff.transformed(calliope.SlurCells())

    s.extend_from(
        flute_high_swells, 
        closing_pizz,ob_cl_dove_riff, 
        piano_riff,
        midpoint_wind_hit
        )
    # # =======================================================
    # BAR 16+
    # 23/24 wind cloud
    # # =======================================================
    s.fill_rests(beats=15*4)
    wind_cloud_23_24 = lambda_segment.LambdaSegment(
        lib("rock_grid_g1_c23_24"),
        fabric_staves = (
            "ooa_flute","ooa_clarinet",
            "ooa_alto_sax1","ooa_alto_sax2","ooa_tenor_sax","ooa_bari_sax",
            ),
        tag_events = {0:("mp", "\\<",), 7:("mf",)},
        # assign_pitches_from_selectable = True,
        # selectable_start_beat = 16*4,
        # func = lambda x: x.slur_cells().bookend_pad(2,3),
        # func = lambda x: x.crop("cells",1),
        func = lambda x: x,
        )

    wind_cloud_23_24.phrases.apply(lambda x:x.auto_respell())
    s.extend_from(wind_cloud_23_24,)

    s.fill_rests(beats=16*4)

    end_wind_hit = lambda_segment.LambdaSegment(
        sb.with_only("chords"),
        ranges=pitch_ranges.BOTTOM_RANGES,
        fabric_staves = instrument_groups.get_instruments(
            "sax","ooa_winds") + ("ooa_trombone",),
        assign_pitches_from_selectable = True,
        selectable_start_beat=12*4,
        func = lambda x: x.with_only("cells",25).bookend_pad(0,1),
        tag_all_note_events=(".",".")
        )
    s.extend_from(end_wind_hit,)

    s.fill_rests(beats=19*4)

    end_winds_improv =  improv.Improv(
        sb,
        fabric_staves = ("ooa_flute", "ooa_clarinet", "ooa_alto_sax1",
            "ooa_alto_sax2"),
        improv_times = 3,
        ranges = pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=19*4,
        dynamic="mp"
        # pitch_selectable_indices = (
        #     (0,2,4,5),
        #     ),
        )
    s.extend_from(
        end_winds_improv,
        )




    # # =======================================================
    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 = 7
            main_seg.compress_full_bar_rests = True
예제 #5
0
 def get_pitch_ranges(self, *args, **kwargs):
     # (importing here to avoid cirular import)
     from imaginary.libraries import pitch_ranges
     return pitch_ranges.PitchRanges()
예제 #6
0
def score0(lib):
    s = score.ImaginaryScore()
    sb0 = lib("lyrical_block0")

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

    # # =======================================================
    s.extend_from(
        pizz_flutter.PizzFlutter(
            sb0,
            bookend_beats=(0,1),
            pizz_flutter_initial = True,
            ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ),
            pizz_dynamic="mp",
            flutter_dynamic="p",
            ),
        )
    s.extend_from(
        pizz_flutter.PizzFlutter(
            sb0,
            selectable_start_beat = 5,
            bookend_beats=(0,3),
            ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ),
            ),
        extend_last_machine = True,
        )
    

    drum_off_cell = ImaginaryCell(rhythm=(1,1,-1,1, -1,1,-1,1), pitches=(-8,9,"R",9,"R",9,"R",9,),)
    drum_off_cell.note_events[1].tag("brushes")
    drum_off_cell.note_events.tag("note_head:0:cross")
    drum_end_cell = ImaginaryCell(
        rhythm=(-0.5, 0.25, 0.25,  -0.5,0.5,-0.5, 0.5,-0.5, 0.25, 0.25,), 
        pitches=("R", 9,  9,   "R", (-8,9),"R", (-8,9), "R", 9,  9,),
        )
    drum_off_cell.note_events[0].tag("p")
    drum_end_cell.note_events.tag("note_head:0:cross")
    drum_end_cell.note_events.tag("note_head:1:cross")
    drum_offs = ImaginarySegment(
        ImaginaryCell(rhythm=(-12,)),
        drum_off_cell,
        get_improv_line(
            rhythm=(1,)*8,
            times=3),
        drum_end_cell,
        )
    s.staves["ooa_drum_set"].append(drum_offs)

    cym_seg = ImaginarySegment(
        calliope.Cell(rhythm=(-1*4,-5*4),),
        calliope.Cell(rhythm=(0.5,-3.5),),
        calliope.Cell(rhythm=(-5*4,),),
        )
    cym_seg.events[0].tag("to sus. cym.", "\\percStaff")
    cym_seg.note_events[0].tag("sus. cym., soft mallets",":32","p","(")
    cym_seg.events[3].tag(")")
    s.staves["cco_percussion"].append(cym_seg)


    # =======================================================
    # intro strings pad
    intro_pad = lyrical.IntroStringsPad(
        sb0,
        selectable_start_beat = 12,
        ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ),
        tag_events = {0:("pp","arco, sul pont")}
        )
        
    flute_melody = lambda_segment.LambdaSegment(
        sb0.with_only("counter_line"),
        fabric_staves = ("ooa_flute",),
        tag_events = {0:("p", "normal, expressive")},
        func = lambda x: x.crop("cells",3).fuse().e_smear_after(1, extend_beats=0.5).eps(
            4,14,"\\<")(
            6,18,"\\>","mp")(
            9,17,21,"\\!")(
            11,20,"p")(
            )
        )
    for fp in flute_melody.phrases:
        fp.mask("events",-1)
        fp.smear_after(fill=True, gap_beats=1)
        fp.slur_cells()
    flute_melody.segments[0]
    flute_melody.segments[0].e_smear_after(12, extend_beats=0.5)

    clarinet_melody = lambda_segment.LambdaSegment(
        sb0.with_only("counter_line"),
        fabric_staves = ("ooa_clarinet",),
        bookend_beats=(12,0),
        func = lambda x: x.crop("cells",3).fuse(
            ).poke("note_events",1,2,6,9,10,14,18
            ).smear_after(fill=True, gap_beats=1, max_beats=5.5).slur_cells().eps(
            1, "expressive")(
            1,6,"p","\\<")(
            4,"\\>","mp")(
            3,8,"\\!")(
            9,"mp")(
            ),

        )

    cello_melody = lambda_segment.LambdaSegment(
        sb0.with_only("bass_line"),
        fabric_staves = ("ooa_cello1","ooa_cello2",),
        tag_events = {0:("pp","arco, thin, spacey fx")},
        func = lambda x: x.crop("cells",1).crop("events",2).e_smear_after(fill=True),
        )
    cello_melody.staves["ooa_cello1"].note_events[0].pitch += 12
    
    # TO DO: manually setting pitch here is nasty
    for n in cello_melody.staves["ooa_cello2"].note_events[:6]:
        n.pitch = -1
    for n in cello_melody.staves["ooa_cello2"].note_events[6:]:
        n.pitch = 4

    s.extend_from(
        intro_pad, 
        cello_melody,
        flute_melody,
        clarinet_melody,
        )
    s.fill_rests(fill_to="cco_violin_i")
        
    # # =======================================================
    intro2_pad = lyrical.Intro2Pad(
        sb0,
        selectable_start_beat = 24,
        ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ),
        )
    intro2_pad.staves["ooa_mallets"].note_events[0].tag("pp", "soft mallets")

    intro3_pad = lyrical.Intro2Pad(
        sb0,
        selectable_start_beat = 36,
        ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ),
        )

    # some wind swells
    swell = lyrical.CcoWindsSwell(
        sb0.with_only("counter_line", "bass_line", "bass_drones"),
        selectable_start_beat = 6*4,
        ranges=pitch_ranges.PitchRanges(
            pitch_ranges.MID_SEQ,
            cco_oboe1 = pitch_ranges.constant_seq(ratio_mid=0.6),
            cco_oboe2 = pitch_ranges.constant_seq(ratio_mid=0.6),
            ),
        )

    s.extend_from(intro2_pad)
    s.extend_from(intro3_pad, swell, swell)

    oboe_melody = lambda_segment.LambdaSegment(
        sb0.with_only("melody_line2"),
        fabric_staves = ("cco_oboe1",),
        func = lambda x: x.crop("cells",2),
        )
    oboe_melody.events(pitch=4).transformed(calliope.Transpose(interval=12))
    oboe_melody.segments[0].slur_cells()

    s.extend_from(oboe_melody)

    s.fill_rests(beats=10*4)
    brass_swells = staggered_swell.StaggeredSwell(
        sb0.with_only("bass_drones", "counter_line"),
        fabric_staves = ("ooa_horn","ooa_trombone","cco_horn","cco_trombone",),
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat = 10*4,
        low_dynamic = "pp",
        swell_dynamic = "mp",
        swell_duration = 8,
        swell_split_ratios = (3/4,),
        swell_staggers = ((0,0),),
    )
    # horns are too low (TO DO: why?) ... so adjust
    for horn_seg in brass_swells.staves["ooa_horn","cco_horn"].segments:
        horn_seg.t(12)
    s.extend_from(brass_swells)

    s.fill_rests(fill_to="cco_violin_i")

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

    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.tempo_command=""" \\note #"4" #UP "= 96 ca" """
            main_seg.rehearsal_mark_number = 2
            main_seg.auto_respell()
            main_seg.compress_full_bar_rests = True
예제 #7
0
def score1(lib):
    s = score.ImaginaryScore()
    sb1 = lib("lyrical_block1")
    s = sb1().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s)

    # =======================================================
    # TO DO... adjust ranges:
    pop_fizz_beats = (2, 4, 2)

    s.extend_from(*[
        pizz_flutter.PizzFlutter(
            sb1,
            pizz_flutter_initial=i == 0,
            pizz_flutter_beats=beats,
            selectable_start_beat=i * sum(pop_fizz_beats[0:i]),
            ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ),
        ) for i, beats in enumerate(pop_fizz_beats)
    ],
                  extend_last_machine=True)

    drum_off_cell = ImaginaryCell(
        rhythm=(
            0.25,
            0.25,
            -0.5,
        ) + (0.5, 0.5, -1) * 3 + (1, ),
        pitches=(
            (-8, 9),
            9,
            "R",
        ) + (9, -8, "R") * 3 + ((-8, 9), ),
    )
    # drum_off_cell.note_events[1].tag("brushes")
    drum_off_cell.note_events.tag("note_head:0:cross")
    drum_off_cell.note_events.tag("note_head:1:cross")
    drum_off_cell.note_events[0].tag("mallets")

    drum_end_cell1 = ImaginaryCell(
        rhythm=(
            0.25,
            0.25,
            -0.25,
            0.25,
            -0.5,
            0.5,
            -0.5,
            0.5,
            -0.5,
            0.25,
            0.25,
        ),
        pitches=(
            (-8, 9),
            9,
            "R",
            9,
            "R",
            (-8, 9),
            "R",
            (-8, 9),
            "R",
            9,
            9,
        ),
    )
    drum_end_cell1.note_events.tag("note_head:0:cross")
    drum_end_cell1.note_events.tag("note_head:1:cross")
    drum_end_cell2 = ImaginaryCell(
        rhythm=(
            0.25,
            0.25,
            0.25,
            -0.25,
            -0.5,
            0.5,
            -0.5,
            0.5,
            -0.5,
            0.25,
            0.25,
        ),
        pitches=(
            9,
            9,
            9,
            "R",
            "R",
            (-8, 9),
            "R",
            (-8, 9),
            "R",
            9,
            9,
        ),
    )
    drum_end_cell2.note_events.tag("note_head:0:cross")
    drum_end_cell2.note_events.tag("note_head:1:cross")
    drum_offs = ImaginarySegment(
        ImaginaryCell(rhythm=(-8, )),
        drum_off_cell,
        get_improv_line(rhythm=(1, ) * 8, times=3),
        drum_end_cell1,
        drum_end_cell2,
    )
    s.staves["ooa_drum_set"].append(drum_offs)

    cym_seg = ImaginarySegment(
        calliope.Cell(rhythm=(-2 * 4, ), ),
        calliope.Cell(rhythm=(1, -3), ),
        calliope.Cell(rhythm=(-3 * 4, ), ),
        calliope.Cell(rhythm=(1, -3), ),
        calliope.Cell(rhythm=(-5 * 4, ), ),
    )
    cym_seg.note_events.tag(":32", "(")
    cym_seg.events[2, 5].tag(")")
    s.staves["cco_percussion"].append(cym_seg)

    intro_melody = lambda_segment.LambdaSegments(
        sb1.with_only("melody_line2"),
        fabric_staves=(
            "cco_oboe1",
            "cco_oboe2",
            "cco_clarinet1",
            "cco_clarinet2",
        ),
        funcs=(
            lambda x: x.with_only("phrases", 0).mask("cells", 1).crop(
                "events", 0, 1).slur_cells(),
            lambda x: x().with_only("phrases", 0).mask(
                "events", 0, 1, 2, 3, 4).crop("events", 0, 1).slur_cells(),
            lambda x: x.with_only("cells", 0, 1, 2).poke("events", 4).
            e_smear_before(extend_beats=3, rearticulate=True).e_smear_after(
                extend_beats=4).ops("note_events")(0, "pp", "\\<")(
                    1,
                    "mp",
                )(),
            lambda x: x.with_only("cells", 0, 1, 2).poke("events", 9).
            e_smear_before(extend_beats=3.5, rearticulate=True).e_smear_after(
                extend_beats=4).ops("note_events")(0, "pp", "\\<")(
                    1,
                    "mp",
                )(),
        ))
    s.extend_from(intro_melody)

    s.fill_rests(beats=8)

    improv_fl_cl = improv.Improv(sb1,
                                 fabric_staves=("ooa_flute", "ooa_clarinet"),
                                 improv_times=10,
                                 selectable_start_beat=8,
                                 ranges=pitch_ranges.MID_RANGES,
                                 after_funcs=(lambda x: x,
                                              lambda x: x.eps(0, "p")()))
    s.extend_from(improv_fl_cl)

    cello_drones = lambda_segment.LambdaSegments(
        sb1.with_only("bass_drones"),
        fabric_staves=(
            "ooa_cello1",
            "ooa_cello2",
        ),
        funcs=(
            lambda x: x.crop("cells", 2).crop_chords(indices=(1, )).fuse().eps(
                0, "arco, distorted")(),
            lambda x: x.crop("cells", 2).crop_chords(indices=(0, )).fuse().eps(
                0, "arco, distorted")(),
        ))
    s.extend_from(cello_drones)

    sax_swells = staggered_swell.StaggeredSwell(
        sb1,
        fabric_staves=instrument_groups.get_instruments("sax"),
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat=8,
        swell_duration=12,
        # swell_split_ratios = (
        #     1/2,
        #     ),
        # swell_staggers = (
        #         (0,1),
        #         (0.5,0.5),
        #         (1,0)
        #     ),
    )
    s.extend_from(sax_swells)

    bass_melody = lambda_segment.LambdaSegments(
        sb1.with_only("bass_line"),
        fabric_staves=("ooa_bass_guitar", "cco_bass", "ooa_bassoon"),
        funcs=(
            lambda x: x.crop("cells", 1).crop_chords(indices=(
                0,
                1,
            )).transformed(calliope.StandardDurations()),
            lambda x: x.crop("cells", 1).crop_chords(indices=(
                1,
                0,
            )).transformed(calliope.StandardDurations()),
            lambda x: x.crop("cells", 1).crop_chords(indices=(1, )).mask(
                "note_events", 2, 3, 8, 12).smear_after(fill=True, gap_beats=1)
            .slur_cells().eps(1, "p")(),
        ),
    )
    s.extend_from(bass_melody)

    # # =======================================================
    # counter to violin i
    counter_violin = lambda_segment.LambdaSegment(
        sb1.with_only("counter_line"),
        func=lambda x: x.crop("phrases", 1).fuse().eps(1, "p", "arco (normal)")
        (2, 7, 9, 12, 14, 16, 20, 25, 27, 30, "(")
        (3, 8, 10, 13, 15, 17, 21, 26, 28, 31, ")")(),
        fabric_staves=("cco_violin_i", ),
    )
    s.extend_from(counter_violin)

    # # =======================================================
    #  string padding:
    # TO DO: vary up the ranges
    pad_durations = (2, 1, 2, 2, 1, 2, 2)  # based on 3 + 5 + 4
    bookend_beats = (
        None,
        (4, 0),
        None,
    )
    start_offset = (8, 8, 12)
    strings_pads = [
        lyrical.Intro2Pad(
            sb1,
            mask_staves=("cco_bass", "cco_violin_i"),
            pad_durations=pad_durations,
            ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ),
            selectable_start_beat=start_offset[i] + sum(pad_durations) * i,
            bookend_beats=bookend_beats[i]) for i in range(3)
    ]
    for st in strings_pads[0].staves:
        st.note_events[0].tag("p", "arco (normal)")
    s.extend_from(*strings_pads)

    s.fill_rests(beats=24)

    # # =======================================================
    # more winds swells:
    # TO DO: vary these up!
    s.extend_from(lyrical.CcoWindsSwell(
        sb1,
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat=6 * 4,
    ),
                  lyrical.CcoWindsSwell(
                      sb1,
                      ranges=pitch_ranges.MID_RANGES,
                      selectable_start_beat=6 * 4 + 6,
                  ),
                  lyrical.CcoWindsSwell(
                      sb1,
                      ranges=pitch_ranges.MID_RANGES,
                      selectable_start_beat=6 * 4 + 12,
                  ),
                  lyrical.CcoWindsSwell(
                      sb1,
                      ranges=pitch_ranges.MID_RANGES,
                      selectable_start_beat=6 * 4 + 18,
                  ),
                  extend_last_machine=True)

    # # =======================================================
    # TO DO MAYBE: re-add these pulses?
    # s.extend_from(
    #     lyrical.CcoStringPulses(
    #         pulse_beats=16,
    #         mask_staves=("cco_bass",),
    #         )
    #     )

    # # =======================================================
    # TO DO MAYBE: re-add these pulses?
    # s.extend_from(
    #     lyrical.CcoStringPulses(
    #         pulse_duration=0.5,
    #         pulse_beats=8,
    #         mask_staves=("cco_bass",),
    #         )
    #     )

    # TO DO MAYBE: add more fragments of counter melody?
    # # =======================================================

    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 = 3
            main_seg.auto_respell()
            main_seg.compress_full_bar_rests = True