Example #1
0
def move_segment(line, respell=None):
    return calliope.Segment(
        line(),
        line().transformed(calliope.Transpose(interval=5)),
        line().transformed(calliope.Transpose(interval=-2)),
        line().transformed(calliope.Transpose(interval=3)),
        line().transformed(calliope.Transpose(interval=-4)),
        respell=respell)
Example #2
0
class DStarVI(phrases.GridMask, phrases.StarPhraseBlock_III_Grid_A):
    transpose_up = calliope.Transpose(interval=2)
    pitches_from_grid_bubble = phrases.star_iii_a_1
    def set_children_from_class(self, *args, **kwargs):
        super().set_children_from_class(*args, **kwargs)
        for phrase_line in self:
            phrase_line.respell = "flats"
Example #3
0
class DStarV(DStarII):
    # V is almost the same as II...
    transpose_up = calliope.Transpose(interval=2)
    def set_children_from_class(self, *args, **kwargs):
        phrases.StarPhraseBlock_II_Grid_A.set_children_from_class(self, *args, **kwargs)
        for phrase_line in self:
            # phrase_line.first_non_rest.tag(">")
            phrase_line.respell = "flats"
Example #4
0
class DStarII(phrases.GridMask, phrases.StarPhraseBlock_II_Grid_A):
    transpose_up = calliope.Transpose(interval=1)
    pitches_from_grid_bubble = phrases.star_ii_a_1
    def set_children_from_class(self, *args, **kwargs):
        super().set_children_from_class(*args, **kwargs)
        for phrase_line in self:
            # phrase_line.first_non_rest.tag(">")
            phrase_line.respell = "sharps"
            phrase_line.add_bookend_rests(8,4)
Example #5
0
class FStarVII(FStarIV):
    transpose_up = calliope.Transpose(interval=2)

    class TransformMe(FStarTransform):
        respell = "flats"

        class SplitBeats(calliope.Transform):
            def transform_nodes(self, machine):
                for phrase_line in machine:
                    split_events(phrase_line[0])
Example #6
0
    def __init__(self, *args, **kwargs):

        super().__init__(*args, **kwargs)

        extend_phrases = [
            phrase().transformed(calliope.Transpose(interval=i))
            for phrase in self for i in self.add_intervals
        ]

        if extend_phrases:
            self.extend(extend_phrases)
Example #7
0
class FStarV(phrases.GridMask, phrases.StarPhraseBlock_II_Grid_A):
    transpose_up = calliope.Transpose(interval=1)
    pitches_from_grid_bubble = phrases.star_ii_a_1

    class TransformMe(FStarTransform):
        respell = "sharps"

        class RemoveFirstCell(calliope.Transform):
            def transform_nodes(self, machine):
                for phrase_line in machine:
                    phrase_line.pop(0)

        class PauseBefore(BookendRests):
            bookend_rests = (2, )
Example #8
0
class FStarVI(phrases.GridMask, phrases.StarPhraseBlock_III_Grid_A):
    transpose_up = calliope.Transpose(interval=1)
    pitches_from_grid_bubble = phrases.star_iii_a_1

    class TransformMe(FStarTransform):
        respell = "sharps"

        class PauseBefore(BookendRests):
            bookend_rests = (1, )

        class ExtendEnd(calliope.Transform):
            def transform_nodes(self, machine):
                for phrase_line in machine:
                    phrase_line.non_rest_events[-1].first_non_rest.beats = 3
Example #9
0
def rock4_ooa_horn_c43_45(lib):
    l = lib["rock_grid_g4_c43_45"][1]().transformed(
        artics.FuseRepeatedNotes()).t(2).eps(0, 2, 4, 6, 8, 10, 13, "(")(
            1,
            3,
            5,
            7,
            9,
            12,
            14,
            ")",
        )(2, 7, "[")(3, 8, "]")()
    l.events[2:].transformed(calliope.Transpose(interval=-12))
    return l
Example #10
0
    def move_t(self, times=1, interval=None, max_octaves=None, wrap_in=None):
        """
        repeats the material (within a wrapper machine),
        transposing by an interval each time
        (creates copies, does NOT alter original)
        """
        max_octaves = max_octaves or self.move_max_octaves
        interval = interval if interval is not None else self.move_interval
        wrap_in = wrap_in or ImaginarySegment

        max_move = max_octaves * (12 if interval > 0 else -12)

        return wrap_in(
            self(), *[
                self().transformed(
                    calliope.Transpose(interval=(interval * (t + 1)) %
                                       max_move)) for t in range(times)
            ])
Example #11
0
class FStarIV(phrases.GridMask, phrases.StarPhraseBlock_I_Grid_A):
    transpose_up = calliope.Transpose(interval=1)
    pitches_from_grid_bubble = phrases.star_i_a_1

    class TransformMe(FStarTransform):
        respell = "sharps"

        class ClarinetUp(PhraseTranspose):
            line = 1
            interval = 12

        class ViolinUp(PhraseTranspose):
            line = 2
            interval = 12

        class MiscOctaves(calliope.Transform):
            def transform_nodes(self, machine):
                machine[1].non_rest_events[0].pitch -= 12
Example #12
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
Example #13
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
Example #14
0
def block0(lib):

    # TO DO... add some fragments from counter B

    bass_undo = lib("integrate_opening").t(-12).bookend_pad(0, 5)
    up_bass_undo = bass_undo().ts(9)
    for i, e in enumerate(bass_undo.cells[:5].events):
        if not e.skip_or_rest:
            e.pitch = [e.pitch, up_bass_undo.events[i].pitch]
    for c in bass_undo.cells[5:10]:
        c.ts(1).stack_p([
            (
                -12,
                0,
            ),
        ])
    for c in bass_undo.cells[10:]:
        c.stack_p([
            (-12, 0, 12),
        ])
    bass_undo.cells[4].note_events[-1:].transformed(
        calliope.Transpose(interval=-12))

    bass_undo.cells[5].note_events[0].pitch = bass_undo.cells[4].note_events[
        -1].pitch

    sb = short_block.get_block().ext_segments(
        counter_line=[lib("counter").bookend_pad(6 * 4, 0)],
        melody_line1=[lib("counter").bookend_pad(6 * 4, 0)],
        riff=[lib("counter").bookend_pad(5 * 4, 0)],
        bass_line=[
            bass_undo,
        ],
        high_drones=[
            drone.DroneLine(
                line_pitches=(28, ),
                phrase_rhythm=(7 * 4, ),
                phrase_count=1,
            ),
            drone.DroneLine(
                line_pitches=(24, ),
                phrase_rhythm=(7 * 4, ),
                phrase_count=1,
            ),
        ],
        mid_drones=[
            drone.DroneLine(
                line_pitches=(p, ),
                phrase_rhythm=(9, ),
                phrase_count=1,
            ) for p in ((11, 16), (16, 21), (9, 14), (14, 19), (19, 24), (12,
                                                                          17))
        ],
        bass_drones=[
            drone.DroneLine(
                line_pitches=((-8, -1), (-10, 0), (-12, 2), (-14, 5)),
                phrase_rhythm=(14, ),
                phrase_count=4,
            )
        ],
    )

    sb.fill_rests()
    return sb
Example #15
0
def score2(lib):
    s = score.ImaginaryScore()
    sb = lib("rock_block2")
    s = sb().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s)

    rim_shots = ImaginaryCell(rhythm=(1, 1, 1, 1), pitches=(2, 2, 2, 2))
    rim_shots.note_events.tag("\\withSlash")

    drum_rhythm2 = lambda_segment.LambdaSegment(
        calliope.SegmentBlock(
            ImaginarySegment(
                lib("rock_rhythm2"),
                get_improv_line(times=8),
                rim_shots,
                get_improv_line(times=6),
                lib("drum_hits") * 3,
            )),
        fabric_staves=("ooa_drum_set", ),
        func=lambda x: x,
    )

    cco_perc1 = osti.Osti(fabric_staves=("cco_percussion", ),
                          osti_pulse_duration=0.5,
                          osti_cell_length=8,
                          osti_cell_count=9,
                          func=lambda x: x.eps(0, "mf")())
    cco_perc2 = lambda_segment.LambdaSegment(
        sb.with_only("high_rhythm"),
        fabric_staves=("cco_percussion", ),
        func=lambda x: x.with_only("cells", 9, 10, 11, 12, 13, 14, 15),
    )
    cco_perc3 = osti.Osti(fabric_staves=("cco_percussion", ),
                          osti_pulse_duration=0.5,
                          osti_cell_length=8,
                          osti_cell_count=3,
                          func=lambda x: x.eps(0, "mf")())
    cco_perc1.note_events.setattrs(pitch=0)
    cco_perc2.note_events.setattrs(pitch=0)
    cco_perc3.note_events.setattrs(pitch=0)
    cco_perc3.cells[-2].note_events[0].tag("\\<")
    cco_perc3.note_events[-1].tag("f")
    s.extend_from(cco_perc1, cco_perc2, cco_perc3)

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

    # TO DO: add ranges
    # =======================================================

    trumpet_mute_outs = ImaginarySegment(
        ImaginaryCell(rhythm=(-4, )).eps(0, "mute out")())
    s.staves["ooa_trumpet"].append(trumpet_mute_outs())
    s.staves["cco_trumpet"].append(trumpet_mute_outs())

    harp1_riff = lambda_segment.LambdaSegment(
        sb.with_only("riff", ),
        fabric_staves=("harp1", ),
        tag_events={0: ("mf", )},
        func=lambda x: x,
    )
    harp1_riff.cells[:16].setattrs(respell="sharps")

    # TO DO: model this pattern... already used multiple times!
    poke_harp1 = []
    next_include = False
    for i, e in enumerate(harp1_riff.events):
        e_pitch = e.pitch
        if len(e_pitch) > 1 and abs(e_pitch[0] - e_pitch[1]) == 12:
            next_include = True
            poke_harp1.append(i)
        elif next_include:
            poke_harp1.append(i)
            next_include = False
        else:
            next_include = False
    harp1_riff.segments[0].poke("events", *poke_harp1)

    piano_riff = lambda_segment.LambdaSegment(
        sb.with_only("riff"),
        fabric_staves=(
            "piano1",
            "piano2",
        ),
        tag_all_note_events=(".", ),
        ranges=pitch_ranges.LOW_TO_HIGH_RANGES,
        assign_pitches_from_selectable=True,
        func=lambda x: x.eps(0, "bass")(),
        funcs=(
            lambda x: x.eps(40, "treble")(136, "8va")(151, "8va!")(),
            lambda x: x.eps(0, "8vb")(23, "8vb!")(112, "treble")(),
        ))
    piano_riff.staves["piano1"].note_events[-1].pitch += 12
    piano_riff.staves["piano1"].phrases[:8].apply(lambda x: x.t(12))
    piano_riff.staves["piano2"].phrases[8:].apply(lambda x: x.t(-12))

    pizz = lambda_segment.LambdaSegment(
        sb.with_only("chords"),
        ranges=pitch_ranges.LOW_TO_HIGH_RANGES,
        fabric_staves=instrument_groups.get_instruments("cco_strings"),
        mask_staves=("cco_bass", ),
        assign_pitches_from_selectable=True,
        func=lambda x: x.transformed(calliope.StandardDurations()))
    pizz.staves["cco_viola"].note_events[0].tag("pizz")

    constant_pluck = osti.Osti(
        sb,
        fabric_staves=instrument_groups.get_instruments(
            "ooa_guitar", "ooa_strings"),
        ranges=pitch_ranges.LOW_TO_HIGH_RANGES,
        osti_pulse_duration=1,
        osti_cell_length=4,
        osti_cell_count=9,
    )
    for st in constant_pluck.staves:
        st.segments[0].eps(0, "mf", "pizz, distorted")()

    s.extend_from(
        harp1_riff,
        piano_riff,
        pizz,
        drum_rhythm2,
        constant_pluck,
    )
    # =======================================================

    # BARS 1-6

    opening_bass = lambda_segment.LambdaSegment(
        sb.with_only("bass_line"),
        assign_pitches_from_selectable=True,
        # ranges=pitch_ranges.PitchRanges(pitch_ranges.BOTTOM_SEQ),
        fabric_staves=("ooa_bassoon", "cco_bassoon", "ooa_trombone",
                       "cco_trombone", "ooa_bass_guitar", "cco_bass"),
        # tag_events = {0:("mf", "pizz")},
        # func = lambda x: x.only_first("cells",7).bookend_pad(0,3),
        # func = lambda x: x.crop("cells",1),
        func=lambda x: x.only_first("cells", 14).transformed(
            calliope.StandardDurations()),
        funcs=(
            lambda x: bass_artics(x),
            lambda x: bass_artics(x),
            lambda x: bass_artics(x.poke("cells", 7, 8, 10, 11)),
            lambda x: bass_artics(x.poke("cells", 7, 8, 10, 11)),
            lambda x: x,
            lambda x: x.eps(1, "pizz")(),
        ))
    for st in opening_bass.staves:
        st.note_events[0].tag("f")

    s.extend_from(opening_bass, )

    # # =======================================================
    wind_cloud_4_5 = lambda_segment.LambdaSegment(
        lib("rock_grid_g2_c4_5"),
        fabric_staves=(
            "ooa_flute",
            "cco_flute1",
            "cco_flute2",
            "ooa_clarinet",
            "cco_clarinet1",
            "cco_clarinet2",
        ),
        # 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),
        bookend_beats=(7, 0),
        tag_all_note_events=("-", ),
        tag_events={
            0: ("mp", "\\<"),
            -1: (".", "f")
        },
        func=lambda x: x,
    )
    sax_opening_driving = driving_off.DrivingOff(
        sb,
        ranges=pitch_ranges.HIGH_TO_LOW_RANGES,
        fabric_staves=instrument_groups.get_instruments("sax", ),
        bookend_beats=(6, 3),
    )

    s.extend_from(
        wind_cloud_4_5,
        sax_opening_driving,
    )

    s.fill_rests(beats=7 * 4)
    # # =======================================================
    cloud_16_17 = lib("rock_grid_g2_c16_17")
    wind_cloud_16_17 = lambda_segment.LambdaSegment(
        cloud_16_17,
        fabric_staves=(
            "ooa_flute",
            "ooa_clarinet",
            "ooa_alto_sax1",
            "ooa_alto_sax2",
            "ooa_tenor_sax",
            "ooa_bari_sax",
        ),
        tag_all_note_events=("-", ),
        tag_events={
            1: ("mp", "\\<"),
            -1: (".", "f")
        },
        func=lambda x: x.bookend_pad(3, 0),
    )
    brass_midpoint_driving = driving_off.DrivingOff(
        sb,
        selectable_start_beat=(7 * 4),
        ranges=pitch_ranges.MID_RANGES,
        fabric_staves=instrument_groups.get_instruments("brass", ),
        bookend_beats=(2, 0),
    )

    s.extend_from(
        wind_cloud_16_17,
        brass_midpoint_driving,
    )

    s.fill_rests(beats=9 * 4)
    # # =======================================================
    # BAR 10+
    # # =======================================================
    mallets_improv1 = improv.Improv(
        sb,
        fabric_staves=("ooa_mallets", ),
        improv_times=3,
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=9 * 4,
        # pitch_selectable_indices = (
        #     (0,1,3,5),
        #     ),
    )
    mallets_improv2 = improv.Improv(
        sb,
        instruction="",
        fabric_staves=("ooa_mallets", ),
        improv_times=4,
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=12 * 4,
        # pitch_selectable_indices = (
        #     (0,2,4,5),
        #     ),
    )
    mallets_improv3 = improv.Improv(
        sb,
        instruction="",
        fabric_staves=("ooa_mallets", ),
        improv_times=3,
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=16 * 4,
        # pitch_selectable_indices = (
        #     (0,2,4,5),
        #     ),
    )
    s.extend_from(mallets_improv1, mallets_improv2, mallets_improv3)

    flute_high_swells = staggered_swell.StaggeredSwells(
        sb,
        low_dynamic="mp",
        swell_dynamic="mf",
        cell_count=1,
        phrase_count=5,
        swell_duration=8,
        selectable_start_beat=9 * 4,
        # swell_split_ratios = (
        #     1/2,
        #     )
        swell_staggers=(
            (0, 4),
            (2, 2),
            (3, 1),
            # (0.5,0.5),
            # (1,0)
        ),
        fabric_staves=(
            "cco_flute1",
            "cco_flute2",
            "ooa_flute",
        ),
    )
    s.extend_from(flute_high_swells, )

    s.fill_rests(beats=12 * 4)
    # # =======================================================
    cloud_26_31 = lib("rock_grid_g2_c26_31")
    wind_cloud_26_31 = lambda_segment.LambdaSegment(
        cloud_26_31,
        fabric_staves=(
            "ooa_clarinet",
            "ooa_alto_sax1",
            "ooa_alto_sax2",
            "ooa_tenor_sax",
            "ooa_bari_sax",
            "ooa_bassoon",
        ),
        tag_all_note_events=("-", ),
        tag_events={
            0: ("mf", "\\<"),
            -1: (".", "f")
        },
        bookend_beats=(3, 1))

    s.extend_from(wind_cloud_26_31, )

    # # =======================================================
    # BAR 16+
    # s.fill_rests(beats=15*4)

    hits_final = lambda_segment.LambdaSegment(
        sb.with_only("chords"),
        ranges=pitch_ranges.HIGHISH_TO_MID_RANGES,
        fabric_staves=instrument_groups.get_instruments(
            "ooa_brass", "ooa_strings") + ("ooa_guitar", "ooa_bass_guitar"),
        assign_pitches_from_selectable=True,
        selectable_start_beat=15 * 4,
        func=lambda x: x.with_only("cells", 32, 33).bookend_pad(3, 1),
        tag_all_note_events=(">", ))
    for st in hits_final.staves["ooa_violin1", "ooa_violin2", "ooa_cello1",
                                "ooa_cello2"]:
        st.note_events[0].tag("arco, distorted")
    s.extend_from(hits_final)

    s.fill_rests(beats=16 * 4)
    strings_improv = improv.Improv(
        sb.with_only("high_drones"),
        fabric_staves=instrument_groups.get_instruments("ooa_strings", ),
        improv_times=3,
        ranges=pitch_ranges.HIGHISH_RANGES,
        selectable_start_beat=16 * 4,
    )
    s.extend_from(strings_improv)

    # # =======================================================
    # 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"])

    for staff in s.staves:
        # staff.phrases.transformed(calliope.Label())
        # staff.lines.transformed(calliope.Label())
        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 = 8
            main_seg.compress_full_bar_rests = True
Example #16
0
class CloselyCellTr2(CloselyCell):
    transpose_2 = calliope.Transpose(interval=2)
Example #17
0
class DStarVIII(DStarVII):
        transpose_up = calliope.Transpose(interval=4)
Example #18
0
def block3(lib):
    sb3 = short_block.get_block()
    melody_line1_b1 = lib("home_b").sc(0.5).t(10).stack_p((
        (0, -7),
        (0, -12),
    ))
    melody_line1_b1.note_events[0,
                                1].transformed(calliope.Transpose(interval=-5))
    melody_line1_ab = lib("home_a_b").sc(0.5).t(15)

    melody_line2_a = lib("home_a").sc(0.5).t(15).stack_p(((0, -12), ))
    melody_line2_ba = lib("home_b_aup4").sc(0.5).t(15)

    my_counter = lib("counter_long_imod").t(15).sc(0.5)
    bass_line_pre = lib("bass_line").t(10).with_only("phrases",
                                                     4).sc(0.5).stack_p(
                                                         ((0, -12), ))
    bass_line = lib("bass_line").t(15).crop("phrases", 0, 1).sc(0.5).stack_p(
        ((0, -12), ))

    high_drones1 = drone.DroneLine(
        line_pitches=((24, 36), ),
        phrase_rhythm=(0.5, 2.5, 1),
        phrase_count=7,
    )
    high_drones2 = drone.DroneLine(
        line_pitches=((25, 37), ),
        phrase_rhythm=(1, 1, 1, 1),
        phrase_count=5,
    )

    bass_drones1 = drone.DroneLine(
        # line_pitches=( (-22,-10), ),
        line_pitches=((-29, -17), ),
        phrase_rhythm=(3, 1),
        phrase_count=3,
    )

    bass_drones2 = drone.DroneLine(
        # line_pitches=( (-21,-9), ),
        line_pitches=(
            (-29, -17),
            (-28, -16),
        ),
        phrase_rhythm=(2, ),
        phrase_count=6,
    )

    bass_drones3 = drone.DroneLine(
        # line_pitches=( (-21,-9), ),
        line_pitches=((-28, -16), ),
        phrase_rhythm=(3, 1),
        phrase_count=3,
    )

    bass_drones4 = drone.DroneLine(
        # line_pitches=( (-21,-9), ),
        line_pitches=(
            (-26, -14),
            (-28, -16),
        ),
        phrase_rhythm=(2, ),
        phrase_count=6,
    )

    sb3.ext_segments(
        melody_line1=[melody_line1_b1, melody_line1_ab],
        melody_line2=[melody_line2_a, melody_line2_ba],
        high_drones=[high_drones1, high_drones2],
        bass_drones=[bass_drones1, bass_drones2, bass_drones3, bass_drones4])
    sb3.fill_rests(beats=8)
    sb3.ext_segments(bass_line=[bass_line_pre], )
    sb3.fill_rests(beats=16)

    sb3.ext_segments(
        counter_line=[my_counter],
        bass_line=[bass_line],
    )

    sb3.fill_rests()
    return sb3
Example #19
0
def bass_line(lib):
    return BassLine().transformed(calliope.Transpose(interval=-12))
Example #20
0
def score3(lib):
    s = score.ImaginaryScore()
    sb3 = lib("lyrical_block3")
    s = sb3().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s)

    # TO DO: add ranges
    # =======================================================
    # throuhout pad / texture

    drum_set = ImaginarySegment(
        lib("drum_dark"), get_improv_line(rhythm=(1, ) * 4, times=9),
        get_improv_line(instruction="improv", rhythm=(0.5, ) * 8, times=1))
    s.staves["ooa_drum_set"].append(drum_set)

    cym_seg = ImaginarySegment(
        # TO DO... this would be good in the library...
        ImaginaryCell(rhythm=(-4 * 9, )),
        ImaginaryCell(rhythm=(4, 4), ).eps(0, 1, ":32")(0, "\\<")(1, "mf")(),
        ImaginaryCell(rhythm=(-4, )).eps(0, "l.v.")(),
    )
    s.staves["cco_percussion"].append(cym_seg)

    s.extend_from(
        lambda_segment.LambdaSegment(
            sb3.with_only("high_drones", ),
            fabric_staves=("piano1", ),
            func=lambda x: x,
        ))
    s.extend_from(
        lambda_segment.LambdaSegment(
            sb3.with_only("bass_drones"),
            fabric_staves=("cco_bass", "piano2"),
            func=lambda x: x.crop("events", 0, 1).eps(22, beats=4)(),
            funcs=(
                lambda x: x.crop_chords((0, ), ),
                lambda x: x,
            ),
        ))
    ooa_strings_pulses = pulse_on_off_beat.PulseOnOffBeat(
        sb3,
        fabric_staves=(
            "ooa_violin1",
            "ooa_violin2",
            "ooa_cello1",
            "ooa_cello2",
        ),
        phrase_beats=(4, ) * 6,
        ranges=pitch_ranges.HIGHISH_TO_LOW_RANGES,
    )
    for st in ooa_strings_pulses.staves:
        for phrase in st.phrases:
            if phrase.note_events:
                phrase.note_events[0].tag(".")
                phrase.note_events[1:].tag("-")
    ooa_strings_pulses2 = osti.Osti(
        sb3,
        fabric_staves=(
            "ooa_violin1",
            "ooa_violin2",
            "ooa_cello1",
            "ooa_cello2",
        ),
        ranges=pitch_ranges.BOTTOM_RANGES,
        selectable_start_beat=6 * 4,
        osti_pulse_duration=1,
        tag_all_note_events=("-", ),
        osti_cell_length=4,
        osti_cell_count=4,
    )
    ooa_strings_pulses3 = pad.Pad(sb3,
                                  fabric_staves=(
                                      "ooa_violin1",
                                      "ooa_violin2",
                                      "ooa_cello1",
                                      "ooa_cello2",
                                  ),
                                  ranges=pitch_ranges.BOTTOM_RANGES,
                                  selectable_start_beat=10 * 4,
                                  pad_durations=(2, 2, 4),
                                  tag_events={
                                      0: ("\\<", ),
                                      2: ("f", )
                                  })
    mallets_osti = osti.Osti(
        sb3.with_only("high_drones"),
        fabric_staves=("ooa_mallets", ),
        ranges=pitch_ranges.TOP_RANGES,
        osti_pulse_duration=0.5,
        osti_cell_length=8,
        osti_cell_count=11,
    )
    for n in mallets_osti.note_events:
        n.pitch = (n.pitch, n.pitch - 12)
    s.extend_from(ooa_strings_pulses, ooa_strings_pulses2, ooa_strings_pulses3,
                  mallets_osti)
    # =======================================================
    # bars 1-4
    # =======================================================
    # melody and bass lines:
    violin_i = lambda_segment.LambdaSegment(
        sb3.with_only("counter_line", ),
        fabric_staves=("cco_violin_i", ),
        func=lambda x: x.scramble("cells", 2, 3, 4, 5, 2, 4, 3).mask(
            "cells", 1, 3).e_smear_after(fill=True).eps(0, 2, 4, 6, 9, "(")
        (1, 3, 5, 7, 10, ")")())

    violin_ii_seg = sb3["melody_line2"]().with_only(
        "cells", 0, 1, 2, 3).crop_chords((0, )).e_smear_after(fill=True)
    violin_ii_seg.note_events[:4].transformed(calliope.Transpose(interval=7))
    violin_ii_seg.note_events[0, 2,
                              5].transformed(calliope.Transpose(interval=12))
    violin_ii_seg.e_smear_after(fill=True).eps(7, 9, 11, "(")(8, 10, 12, ")")()
    s["cco_violin_ii"].append(violin_ii_seg)

    viola_cello = lambda_segment.LambdaSegments(
        sb3.with_only("melody_line1", ),
        fabric_staves=(
            "cco_viola",
            "cco_cello",
        ),
        func=lambda x: x.with_only("cells", 0, 1, 2, 3).e_smear_after(
            fill=True).eps(
                1,
                "div.",
            )(1, 6, 9, 15, "(")(2, 7, 10, 16, ")")(),
        funcs=(lambda x: x, lambda x: x.t(-12)),
    )

    s.extend_from(violin_i, viola_cello)

    # pads
    s.extend_from(
        lyrical.SaxSwell(
            sb3.with_only("bass_drones", ),
            ranges=pitch_ranges.get_ranges(ratio_mid=0.7, spread=16),
            swell_dynamic="mf",
            swell_duration=8,
        ),
        lyrical.SaxSwell(
            sb3,
            selectable_start_beat=8,
            ranges=pitch_ranges.get_ranges(ratio_mid=0.6, spread=16),
            swell_dynamic="mf",
            swell_duration=8,
        ),
        lyrical.SaxSwell(
            sb3.with_only("counter_line", ),
            selectable_start_beat=16,
            ranges=pitch_ranges.get_ranges(ratio_mid=0.6, spread=16),
            swell_dynamic="mf",
            swell_duration=8,
        ),
    )

    # =======================================================
    # bars 5-12
    # =======================================================
    # lines
    violin_i = lambda_segment.LambdaSegment(
        sb3.with_only("counter_line", ),
        fabric_staves=("cco_violin_i", ),
        bookend_beats=(2, 0),
        func=lambda x: x.crop("cells", 2).mask("cells", 4, 5).crop(
            "events", 0, 6).e_smear_after(fill=True).eps(
                0, 2, 5, 8, 11, 13, 15, 18, 21, "(")
        (1, 3, 6, 9, 12, 14, 16, 19, 22, ")")(23, 24, 25, 26, 27, 28, 29, "-")
        (29, beats=0.5)(30, beats=4)())
    for c in violin_i.cells[2:]:
        c.t(-12)
    violin_ii = lambda_segment.LambdaSegment(
        sb3.with_only("melody_line2", ),
        fabric_staves=("cco_violin_ii", ),
        func=lambda x: x.crop("cells", 4).mask("cells", 2).e_smear_after(
            fill=True).crop("events", 0, 1).eps(1, 5, 9, 11, 16, "(")
        (2, 6, 10, 12, 17, ")")(19, 20, 21, 22, "-")(22, beats=0.5)
        (23, beats=4)().t(-12)  #.label("events")
    )
    viola = lambda_segment.LambdaSegment(
        sb3.with_only("melody_line1", ),
        fabric_staves=("cco_viola", ),
        func=lambda x: x.crop("cells", 4).e_smear_after(fill=True).crop(
            "events", 0, 3).eps(1, "f")(1, 4, 7, 9, 13, 17, 19, 21, "(")
        (2, 5, 8, 10, 14, 18, 20, 22, ")")(23, 24, "-")(24, beats=1)
        (25, beats=4)()  #.label("events")
    )
    cello = lambda_segment.LambdaSegment(
        sb3.with_only("bass_line", ),
        fabric_staves=("cco_cello", ),
        func=lambda x: x.crop("cells", 3).crop_chords(
            (0, )).crop("events", 0, 4).eps(1, "f")(1, 11, 18, "(")
        (2, 12, 19, ")")(24, 25, 26, 27, "-")(28, beats=4)()  #.label("events")
    )

    s.extend_from(violin_i, violin_ii, viola, cello)

    guitar_improv1 = improv.Improv(
        sb3,
        instruction="improv on these pitches, spacyey fx",
        fabric_staves=("ooa_guitar", ),
        improv_times=3,
        ranges=pitch_ranges.MID_RANGES,
        # selectable_start_beat=7*4,
        dynamic="mf")
    guitar_improv2 = improv.Improv(
        sb3,
        instruction="",
        fabric_staves=("ooa_guitar", ),
        improv_times=3,
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat=3 * 4,
    )
    s.extend_from(guitar_improv1, guitar_improv2)
    s.fill_rests(beats=6 * 4)

    guitar_improv3 = improv.Improv(
        sb3,
        instruction="",
        fabric_staves=("ooa_guitar", ),
        improv_times=3,
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat=6 * 4,
    )
    guitar_improv3_bass = improv.Improv(
        sb3,
        instruction="improv on these pitches, spacey fx",
        fabric_staves=("ooa_bass_guitar", ),
        improv_times=3,
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat=6 * 4,
        dynamic="mf")
    s.extend_from(guitar_improv3, guitar_improv3_bass)
    guitar_improv4 = improv.Improv(
        sb3,
        instruction="",
        fabric_staves=(
            "ooa_guitar",
            "ooa_bass_guitar",
        ),
        improv_times=2,
        ranges=pitch_ranges.MID_RANGES,
        selectable_start_beat=9 * 4,
    )
    s.extend_from(guitar_improv4)

    # anything here?
    s.fill_rests(beats=11 * 4)

    s.fill_rests()

    # 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.rehearsal_mark_number = 5
            main_seg.compress_full_bar_rests = True
Example #21
0
def score4(lib):
    s = score.ImaginaryScore()
    sb = lib("integrate_block4")
    s = sb().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s)

    drum_set = ImaginarySegment(
        get_improv_line(instruction="improv", rhythm=(0.5, ) * 8,
                        times=16).eps(0, "f")(), )
    s.staves["ooa_drum_set"].append(drum_set)

    string_pulses = pulse_on_off_beat.PulseOnOffBeat(
        sb,
        fabric_staves=("ooa_violin1", "ooa_violin2", "ooa_cello1",
                       "ooa_cello2", "cco_violin_i", "cco_violin_ii",
                       "cco_viola", "cco_cello", "cco_bass"),
        after_func=lambda x: x.eps(0, "f")(),
        phrase_beats=(4, ) * 16,
        ranges=pitch_ranges.HILL_DOWN_RANGES,
    )
    string_pulses.staves["cco_bass"].phrases[0].t(-12)
    string_pulses.staves["cco_bass"].phrases[1].t(-12)
    s.extend_from(string_pulses)

    guitars = osti.Osti(sb.with_only("bass_drones"),
                        fabric_staves=(
                            "ooa_bass_guitar",
                            "ooa_guitar",
                        ),
                        ranges=pitch_ranges.BOTTOM_RANGES,
                        osti_pulse_duration=1,
                        osti_cell_length=16,
                        osti_cell_count=3,
                        after_func=lambda x: x.eps(0, "fat fx", "f")())
    for seg in guitars.segments:
        seg.stack_p([(0, 7)])
    guitars_end = osti.Osti(sb.with_only("bass_drones"),
                            fabric_staves=(
                                "ooa_bass_guitar",
                                "ooa_guitar",
                            ),
                            ranges=pitch_ranges.BOTTOM_RANGES,
                            osti_pulse_duration=4,
                            osti_cell_length=1,
                            osti_cell_count=4,
                            after_func=lambda x: x.eps(0, "distorted")
                            (2, "\\>")())
    for seg in guitars_end.segments:
        seg.stack_p([(0, 7)])
    guitars_end.cells.setattrs(respell="sharps")
    trombones = lambda_segment.LambdaSegment(
        sb.with_only("bass_line"),
        fabric_staves=("ooa_trombone", "cco_trombone"),
        func=lambda x: x.eps(1, "ff")(),
        # func = lambda x: x.only_first("cells",8)
    )

    timp_seg = trombones.staves["cco_trombone"].segments[0]().crop(
        "cells", 0, 1)
    for n in timp_seg.note_events:
        if not n.pitch in (-23, -21, -16, -11, -9, -4):
            n.pitch = "R"
    timp_seg.transformed(calliope.StandardDurations()).ops("note_events")(
        0, "ff")()
    timp_seg.smart_ranges([(-17, -5)])
    timp_seg.note_events.tag(">")
    timp_seg.append(
        ImaginaryCell(rhythm=(2, 2), ).eps(0, "\\percStaff",
                                           "sus. cym. (timp beaters)", "mp",
                                           "\\<", ":32")(1, "f", ":32")())

    s.staves["cco_percussion"].append(timp_seg)

    trombones.staves["ooa_trombone"].note_events[-9].tag("\\>")
    trombones.staves["cco_trombone"].note_events[-9].tag("\\>")
    trombones.staves["ooa_trombone"].note_events[-1].tag("mf")
    trombones.staves["cco_trombone"].note_events[-1].tag("p")
    s.extend_from(guitars, trombones)

    sax_melody = lambda_segment.LambdaSegment(
        sb.with_only("high_drones"),
        fabric_staves=instrument_groups.get_instruments(
            "ooa_winds",
            "sax",
        ) + ("ooa_horn", "ooa_trumpet"),
        func=lambda x: x.only_first("cells", 4).slur_cells().ops("note_events")
        (0, "f")(),
        funcs=(
            lambda x: x.t(12),  #fl
            lambda x: x,  #cl
            lambda x: x.t(-24),  #bsn
            lambda x: x,  #as
            lambda x: x.t(-5),  #as
            lambda x: x.t(-12),  #ts
            lambda x: x.t(-24),  #bs
            lambda x: x.t(-12),  #hn
            lambda x: x.t(-12),  #tpt
        ))

    cco_melody = lambda_segment.LambdaSegment(
        sb.with_only("mid_drones"),
        fabric_staves=instrument_groups.get_instruments("cco_winds", ) +
        ("cco_horn", "cco_trumpet"),
        func=lambda x: x.only_first("cells", 4).slur_cells().ops("note_events")
        (0, "f")(),
        funcs=(
            lambda x: x.t(12),  #fl
            lambda x: x.t(12),  #fl
            lambda x: x.t(12),  #ob
            lambda x: x.t(12),  #ob
            lambda x: x,  #cl
            lambda x: x,  #cl
            lambda x: x.t(-24),  #bsn
            lambda x: x.t(-12),  #hn
            lambda x: x.t(0),  #tpt
        ))

    altos1 = lambda_segment.LambdaSegments(
        sb.with_only("counter_line"),
        fabric_staves=("ooa_alto_sax2", "ooa_alto_sax1"),
        funcs=(
            lambda x: x.with_only("cells", 16, 17, 18, 19).poke("cells", 0, 2).
            smear_after(fill=True, gap_beats=1).slur_cells().eps(0, "f")(),
            lambda x: x.with_only("cells", 16, 17, 18, 19).poke("cells", 1, 3).
            smear_after(fill=True, gap_beats=1).slur_cells().eps(2, "f")(),
        ))
    altos2 = lambda_segment.LambdaSegments(
        sb.with_only("melody_line1", "melody_line2"),
        fabric_staves=("ooa_alto_sax1", "ooa_alto_sax2"),
        funcs=(
            lambda x: x.with_only("cells", 10, 11).slur_cells().eps()(),
            lambda x: x.with_only("cells", 10, 11).slur_cells().eps()(),
        ))

    end_doves = x = dovetail.Dovetail(
        sb,
        fabric_staves=("cco_horn", "cco_trumpet", "cco_trombone",
                       "cco_bassoon"),
        ranges=pitch_ranges.LOW_TO_HIGH_RANGES,
        selectable_start_beat=10 * 4,
        tag_all_note_events=("."),
        # dove_count = 4,
        # dove_event_count = 4,
        # tail_event_count = 1,
        dovetail_duration=24,
        # event_duration = 0.5,
        offset=3,
        after_func=lambda x: x.ops("note_events")(0, "f")())

    horns_end = lambda_segment.LambdaSegments(
        sb.with_only("bass_line"),
        fabric_staves=("ooa_horn", "cco_horn"),
        bookend_beats=(4 * 4, 0),
        funcs=(
            lambda x: x.with_only("cells", 12, 13, 14, 15).t(12).eps(0, "f")
            (0, 3, 6, "(")(1, 5, 7, ")")(8, 9, 10, 11, 12, 13, 14, 15, 16, "-")
            (
                8,
                "\\>",
            )(16, "mf")(),
            lambda x: x.with_only("cells", 12, 13, 14, 15).eps(0, "f")
            (0, 3, 6, "(")(1, 5, 7, ")")(8, 9, 10, 11, 12, 13, 14, 15, 16, "-")
            (
                8,
                "\\>",
            )(16, "p")(),
        )
        # func = lambda x: x.only_first("cells",8)
    )

    end_piano_harp = osti.Osti(sb,
                               fabric_staves=("harp1", "harp2", "piano1",
                                              "piano2"),
                               ranges=pitch_ranges.HIGHISH_TO_MID_RANGES,
                               osti_pulse_duration=0.5,
                               osti_cell_length=8,
                               osti_cell_count=12,
                               tag_all_note_events=(">"),
                               after_funcs=(
                                   lambda x: x.eps(0, "f")(),
                                   lambda x: x,
                                   lambda x: x.eps(0, "f")(),
                                   lambda x: x,
                               ))
    end_piano_harp.staves["piano2"].segments[0].t(-12)

    end_roll = pad.Pad(
        sb.with_only("bass_drones"),
        fabric_staves=("ooa_mallets", ),
        ranges=pitch_ranges.HIGHISH_RANGES,
        pad_durations=(4, ) * 16,
        tag_all_note_events=(":32", ),
    )

    s.extend_from(sax_melody, cco_melody, altos1, altos2, horns_end,
                  end_piano_harp, end_roll, guitars_end)

    s.fill_rests(beats=12 * 4)
    # # ================================================
    # # LAST 4 BARS
    improv_tenor_bari_bsn_end = improv.Improv(sb,
                                              fabric_staves=("ooa_tenor_sax",
                                                             "ooa_bari_sax",
                                                             "ooa_bassoon"),
                                              improv_times=4,
                                              selectable_start_beat=12 * 4,
                                              ranges=pitch_ranges.MID_RANGES,
                                              pitch_selectable_indices=((
                                                  1,
                                                  3,
                                                  4,
                                              ), (
                                                  1,
                                                  4,
                                                  5,
                                              ), (
                                                  2,
                                                  3,
                                                  5,
                                              )),
                                              dynamic="mf")
    s.extend_from(improv_tenor_bari_bsn_end, )

    s.fill_rests(beats=14 * 4)
    # # ================================================
    # # LAST 2 BARS

    trumpets_end = lambda_segment.LambdaSegments(
        sb.with_only("melody_line1", "melody_line2"),
        fabric_staves=("ooa_trumpet", "cco_trumpet"),
        # bookend_beats=(6*4,0),
        funcs=(lambda x: x.with_only("cells", 14, 15).eps(1, "mf", "\\>")
               (8, "mp")
               (), lambda x: x.with_only("cells", 14, 15).eps(1, "mf", "\\>")
               (7, "p")()),
        tag_all_note_events=("-", ),
        # func = lambda x: x.only_first("cells",8)
    )
    flutes_end = lambda_segment.LambdaSegment(
        sb.with_only("counter_line"),
        fabric_staves=("ooa_flute", "cco_flute1", "cco_flute2"),
        func=lambda x: x.with_only("cells", 28, 29, 30, 31),
        funcs=(
            lambda x: x.eps(1, "f", "\\>")(15, "mf")(),
            lambda x: x.eps(1, "f", "\\>")(15, "p")(),
            lambda x: x.eps(1, "f", "\\>")(15, "p")(),
        ),
        tag_all_note_events=("-", ),
        # func = lambda x: x.only_first("cells",8)
    )

    improv_cl_alto_end = improv.Improv(sb,
                                       fabric_staves=("ooa_clarinet",
                                                      "ooa_alto_sax1",
                                                      "ooa_alto_sax2"),
                                       improv_times=2,
                                       selectable_start_beat=4 * 14,
                                       ranges=pitch_ranges.HIGHISH_RANGES,
                                       pitch_selectable_indices=(
                                           (1, 3, 4),
                                           (1, 2, 3),
                                           (1, 2, 3),
                                       ),
                                       dynamic="mf")

    s.extend_from(trumpets_end, flutes_end, improv_cl_alto_end)

    s.staves["cco_violin_i"].segments[-1].mask("cells", -1, -2, -3, -4)
    s.staves["cco_violin_ii"].segments[-1].mask("cells", -1, -2)
    s.staves["cco_cello"].segments[-1].mask("cells", -1, -2)
    # s.staves["ooa_cello2"].segments[-1].mask("cells",-1,-2)
    # s.staves["ooa_violin2"].segments[-1].mask("cells",-1,-2)

    # s.staves["cco_flute2"].segments[0].mask("cells",-1,)
    # s.staves["cco_flute2"].note_events[-4].tag("\\>")
    # s.staves["cco_flute2"].note_events[-1].tag("p")

    e0 = free_segment.AlocFreeSegmentBlock(
        tempo_command=""" freely, aprox 30''  """)

    s.staves["ooa_flute"].events[-7].tag("\\>")
    s.staves["ooa_flute"].events[-1].tag("\\!")
    e0["ooa_flute"].machine_arrow(intro.hold_cell(20, ).eps(0, ")")(),
                                  instruction="repeat, slowing down",
                                  with_repeat=False).eps(1, "\\>")(9, "pp")()
    e0["ooa_flute"].respell = "sharps"

    e0["ooa_clarinet"].machine_arrow(lib("cell_rest1") +
                                     lib("intro_cell_down").t(7),
                                     instruction="repeat, slowing down",
                                     with_repeat=False).eps(
                                         3,
                                         "\\>",
                                     )(9, "pp")()
    e0["ooa_clarinet"].respell = "sharps"

    e0["ooa_alto_sax1"].machine_arrow(
        s.staves["ooa_alto_sax1"].cells[-1](),
        instruction="repeating a simple figure 4X, slowing down",
        with_repeat=False).eps(1, "\\>")(9, "pp")()

    e0["ooa_alto_sax2"].machine_arrow(
        s.staves["ooa_alto_sax2"].cells[-1](),
        instruction="repeating a simple figure 3X, slowing down",
        with_repeat=False).eps(1, "\\>")(9, "pp")()

    tenor_end = lib("intro_a_phrase_0").t(7).cells[1] + lib(
        "intro_a_phrase_0").t(7).cells[0]

    e0["ooa_tenor_sax"].machine_arrow(tenor_end,
                                      instruction="repeat, slowing down",
                                      with_repeat=False).eps(
                                          1,
                                          "\\>",
                                      )(9, "pp")()

    e0["ooa_bari_sax"].machine_arrow(intro.hold_cell(-8, ).eps(0, ")")(),
                                     instruction="repeat 3X, slowing down",
                                     with_repeat=False).eps(1, "\\>")(9,
                                                                      "pp")()

    e0["ooa_bassoon"].machine_arrow(intro.hold_cell(-15, ).eps(0, ")")(),
                                    instruction="repeat 2X, slowing down",
                                    with_repeat=False).eps(1, "\\>")(9, "pp")()

    horn_end = s.staves["ooa_horn"].phrases[-1]()
    horn_end.events.untag("-")
    horn_end.t(-12).eps(0, pitch="R")(1, "\\>")(1, 4,
                                                "(")(2, 6,
                                                     ")")(3, 7, 8,
                                                          beats=2)(8, "pp")()
    horn_end.note_events[-1].pitch += 12

    e0["ooa_horn"].machine_arrow(horn_end,
                                 instruction="repeat 3X, slowing down",
                                 with_repeat=False)

    trumpet_end = lib("intro_a_phrase_1").cells[1]().t(14).eps(1, "fermata")()
    e0["ooa_trumpet"].machine_arrow(trumpet_end,
                                    instruction="repeat, 2X",
                                    with_repeat=False).eps(1, "\\>")(9, "pp")()

    e0["ooa_trombone"].machine_arrow(lib("intro_cell_down").t(-5),
                                     instruction="repeat 2X",
                                     with_repeat=False).eps(
                                         1,
                                         "\\>",
                                     )(9, "pp")()
    e0["ooa_trombone"].respell = "sharps"

    e0["ooa_mallets"].machine_arrow(ImaginaryCell(rhythm=(4, ),
                                                  pitches=(16, )).eps(
                                                      0, ":32")(),
                                    with_repeat=False).eps(1, "\\>")(9, "pp")()

    e0["ooa_drum_set"].machine_arrow(get_improv_line(
        instruction="improv, rolls",
        rhythm=(4, ),
        times=1,
    ).eps(0, "fermata", ":32")(),
                                     with_repeat=False).eps(1, "\\>")(9,
                                                                      "pp")()

    e0["ooa_guitar"].machine_arrow(intro.hold_cell(8, ),
                                   with_repeat=False).eps(
                                       1, "\\>", "distorted, ethereal")(9,
                                                                        "pp")()
    e0["ooa_guitar"].respell = "sharps"

    e0["ooa_bass_guitar"].machine_arrow(intro.hold_cell(-15, ),
                                        with_repeat=False).eps(
                                            1, "\\>",
                                            "distorted, ethereal")(9, "pp")()

    # (NOTE: switching strings between 1 and 2)

    ooa_vln1_end = s.staves["ooa_violin2"].phrases[-1]()
    ooa_vln1_end.note_events[-1].pitch -= 12

    e0["ooa_violin1"].machine_arrow(
        ooa_vln1_end,
        instruction="repeat 3X, slowing down (not together with others)",
        with_repeat=False).eps(1, "\\>")(9, "pp")()

    e0["ooa_violin2"].machine_arrow(
        s.staves["ooa_violin1"].phrases[-1](),
        instruction="repeat 4X, slowing down (not together with others)",
        with_repeat=False).eps(1, "\\>")(9, "pp")()

    ooa_vc1_end = s.staves["ooa_cello2"].phrases[-1]()
    ooa_vc1_end.note_events[-1].pitch -= 12
    ooa_vc1_end.note_events[-2].pitch -= 12

    e0["ooa_cello1"].machine_arrow(
        ooa_vc1_end,
        instruction="repeat 2X, slowing down (not together with others)",
        with_repeat=False).eps(1, "\\>")(9, "pp")()

    e0["ooa_cello2"].machine_arrow(
        s.staves["ooa_cello1"].phrases[-1](),
        instruction="repeat 5X, slowing down (not together with others)",
        with_repeat=False).eps(1, "\\>")(9, "pp")()

    e0["cco_flute1"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                   with_repeat=False)

    e0["cco_flute2"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                   with_repeat=False)

    e0["cco_oboe1"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                  with_repeat=False)

    e0["cco_oboe2"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                  with_repeat=False)

    e0["cco_clarinet1"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                      with_repeat=False)

    e0["cco_clarinet2"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                      with_repeat=False)

    e0["cco_bassoon"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                    with_repeat=False)

    e0["cco_horn"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                 with_repeat=False)

    e0["cco_trumpet"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                    with_repeat=False)

    e0["cco_trombone"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                     with_repeat=False)

    e0["cco_percussion"].machine_arrow(lib("cell_rest4").eps(
        0, "fermata", "l.v.")(),
                                       with_repeat=False)

    e0["harp1"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                              with_repeat=False)

    e0["harp2"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                              with_repeat=False)

    e0["piano1"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                               with_repeat=False)

    e0["piano2"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                               with_repeat=False)

    e0["cco_violin_i"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                     with_repeat=False)

    e0["cco_violin_ii"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                      with_repeat=False)

    e0["cco_viola"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                  with_repeat=False)

    e0["cco_cello"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                  with_repeat=False)

    e0["cco_bass"].machine_arrow(lib("cell_rest4").eps(0, "fermata")(),
                                 with_repeat=False)

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

    s.fill_rests(beats=16 * 4)

    for st in s.staves:
        try:
            end_seg = e0[st.name]
            if end_seg.events:
                end_seg.events[-1].tag("""!\\bar "|." """)
            st.append(end_seg)
        except:
            print("st.name not in final free block")

    # s.staves["cco_violin_i"].append(b0["cco_violin_i1"]
    #     )

    # 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",
    #         "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")
    #     )

    # # 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"),
    #     )

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

    # s.fill_rests(fill_to="cco_violin_i")

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

    # # =======================================================
    # adjust for bass 8va

    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]
            main_seg.tempo_command = """ \\note #"4" #UP "= 112 ca" """
            for next_seg in list(segs[1:-1]):
                main_seg.extend(next_seg)
                next_seg.parent.remove(next_seg)
            main_seg.rehearsal_mark_number = 13
            main_seg.compress_full_bar_rests = True
Example #22
0
def score2(lib):
    s = score.ImaginaryScore()
    sb = lib("integrate_block2")

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

    strings = pad.Pad(
        sb.with_only("bass_drones"),
        fabric_staves=instrument_groups.get_instruments("cco_strings"),
        pad_durations=(1 * 4, 8 * 4, 2 * 4, 4 * 4, 4, 4),
        # bookend_beats=(4,0),
        ranges=pitch_ranges.MID_RANGES,
        after_func=lambda x: x.eps(0, "pp", "fermata")(4, "mp", "\\<")(
            5,
            "mf",
        )())
    strings.cells.setattrs(respell="flats")
    for n in strings.staves["cco_cello"].note_events[1:]:
        n.pitch -= 12
    for st in strings.staves["cco_violin_i", "cco_violin_ii"]:
        st.segments[0].note_events[-1].pitch -= 12
        st.segments[0].mask("events", 1)
    s.extend_from(strings)

    for st in s.staves:
        unused_staves = s.unused_staves_at_beat(0)
        if st.name in unused_staves:
            st.append(
                ImaginarySegment(
                    ImaginaryCell(rhythm=(-4, )).eps(0, "fermata")()))

    drum_set = ImaginarySegment(
        ImaginaryCell(rhythm=(-4 * 8, )),
        lib("drum_quick_off").eps(0, "p")(),
        get_improv_line(rhythm=(1, ) * 4, times=7),
    )
    s.staves["ooa_drum_set"].append(drum_set)

    trumpets = lambda_segment.LambdaSegments(
        sb.with_only("melody_line1"),
        fabric_staves=("ooa_trumpet", "cco_trumpet"),
        func=lambda x: x.crop("cells", 1),
        funcs=(
            lambda x: x.only_first("cells", 8).
            e_smear_after(7, cover_notes=True, extend_beats=4).e_smear_after(
                13, cover_notes=True, extend_beats=2).e_smear_after(
                    17, cover_notes=True, extend_beats=0.5).e_smear_after(
                        21, cover_notes=True, extend_beats=1).e_smear_after(
                            24, cover_notes=True, extend_beats=1).
            e_smear_after(28, cover_notes=True, extend_beats=1).mask(
                "events", 8).slur_cells().eps(1, "mp", "solo")(),
            lambda x: x.crop("cells", 8).bookend_pad(8 * 4).mask(
                "events", 2).e_smear_before(
                    3,
                    cover_notes=True,
                    extend_beats=2,
                ).e_smear_after(
                    10,
                    cover_notes=True,
                    extend_beats=0.5,
                ).e_smear_after(
                    17,
                    cover_notes=True,
                    extend_beats=0.5,
                ).e_smear_after(
                    21,
                    cover_notes=True,
                    extend_beats=0.5,
                ).e_smear_after(
                    24,
                    cover_notes=True,
                    extend_beats=1,
                ).e_smear_after(
                    29,
                    cover_notes=True,
                    extend_beats=0.5,
                    # ).e_smear_after(3, cover_notes=True, extend_beats=1
                ).t(-12).slur_cells().eps(1, "mp", "solo")(),
        ))
    trumpets.staves["cco_trumpet"].note_events[-6].tag("\\<")
    trumpets.staves["cco_trumpet"].note_events[-1].tag("mf")

    wind_swells = lambda_segment.LambdaSegments(
        sb.with_only("melody_line1"),
        fabric_staves=("ooa_clarinet", "ooa_alto_sax1", "ooa_alto_sax2",
                       "cco_clarinet1", "cco_clarinet2"),
        func=lambda x: x.crop("cells", 1),
        funcs=(
            lambda x: x.crop("cells", 0, 4).poke("events", 7, 10, 14, 18, 27).
            smear_before(extend_beats=1.5, rearticulate=True).smear_after(
                fill=True, gap_beats=0.5, max_beats=4).eps(
                    1, 4, 7, 10, 13, "ppp", "\\<")(2, 5, 8, 11, 14, "p", "\\>")
            (3, 6, 9, 12, 15, "\\!")(),
            lambda x: x.poke("events", 5, 11, 17, 24).smear_before(
                extend_beats=1.5, rearticulate=True).smear_after(
                    fill=True, gap_beats=0.5, max_beats=4).eps(
                        1, 4, 7, 10, 13, "ppp", "\\<")
            (2, 5, 8, 11, 14, "p", "\\>")(3, 6, 9, 12, 15, "\\!")(),
            lambda x: x.poke("events", 6, 12, 16, 23).smear_before(
                extend_beats=1.5, rearticulate=True).smear_after(
                    fill=True, gap_beats=0.5, max_beats=4).eps(
                        1, 4, 7, 10, 13, "ppp", "\\<")
            (2, 5, 8, 11, 14, "p", "\\>")(3, 6, 9, 12, 15, "\\!")(),
            lambda x: x.poke("events", 38, 46, 50, 55, 63).smear_before(
                extend_beats=1.5, rearticulate=True).smear_after(
                    fill=True, gap_beats=0.5, max_beats=4).eps(
                        1, 4, 7, 10, 13, "ppp", "\\<")
            (2, 5, 8, 11, 14, "p", "\\>")(3, 6, 9, 12, 15, "\\!")(),
            lambda x: x.poke("events", 42, 48, 52, 57, 65).smear_before(
                extend_beats=1.5, rearticulate=True).smear_after(
                    fill=True, gap_beats=0.5, max_beats=4).eps(
                        1, 4, 7, 10, 13, "ppp", "\\<")
            (2, 5, 8, 11, 14, "p", "\\>")(3, 6, 9, 12, 15, "\\!")(),
        ),
    )

    counter_me = lambda_segment.LambdaSegments(
        sb.with_only("counter_line"),
        fabric_staves=("cco_flute1", "cco_flute2", "ooa_mallets", "harp1",
                       "cco_oboe1", "cco_oboe2", "cco_horn"),
        func=lambda x: x.crop("cells", 1).auto_respell(),
        funcs=(
            lambda x: x.eps(1, "p")(),
            lambda x: x.eps(1, "p")(),
            lambda x: x.transformed(
                calliope.StandardDurations(
                    min_duration=0.25,
                    standard_duration=0.5,
                )).eps(1, "p")(),
            lambda x: x.poke("events", 1, 3, 6, 8, 9, 15, 22, 24, 26, 29, 31,
                             32).smear_after(min_beats=1, ).transformed(
                                 calliope.StandardDurations()).eps(1, "mp")(),
            lambda x: x.poke(
                "events",
                1,
                6,
                15,
                24,
                29,
            ).smear_after(min_beats=1, ).smear_before(
                extend_beats=2,
                gap_beats=0.5,
                rearticulate=True,
            ).ops("note_events")(0, 2, 4, 6, 8, "pp", "\\<")
            (1, 3, 5, 7, 9, "mp", ".")(),
            lambda x: x.poke(
                "events",
                3,
                8,
                22,
                26,
                31,
            ).smear_after(min_beats=1, ).smear_before(
                extend_beats=2,
                gap_beats=0.5,
                rearticulate=True,
            ).ops("note_events")(0, 2, 4, 6, 8, "pp", "\\<")
            (1, 3, 5, 7, 9, "mp", ".")(),
            lambda x: x.poke("cells", 13, 14, 15, 16, 17).fuse().t(
                -12).slur_cells().ops("note_events")(0, "p", "\\<")(
                    11,
                    "mf",
                )(),
        ))
    for fi, f in enumerate(counter_me.staves("cco_flute1", "cco_flute2")):
        for i, c in enumerate(f.cells):
            if i % 2 == fi:
                c.poke("events", 0).ops("note_events")(0, ".")()
            else:
                c.note_events[:-1].tag("-")
                c.note_events[-1:].tag(".")
        f.transformed(
            calliope.StandardDurations(
                min_duration=0.25,
                standard_duration=0.5,
            ))
    # flutes.slur_cells()

    cym_like_mallets = counter_me.staves["ooa_mallets"]()
    cym_like_mallets.note_events.setattrs(pitch=0)

    cym_line = ImaginaryLine(
        ImaginaryCell(rhythm=(-4 * 7, ), ),
        ImaginaryCell(rhythm=(4, ), ).eps(0, ":32", "pp", "sus. cym., brushes",
                                          "\\<", "\\percStaff")(),
        *cym_like_mallets.cells[1:],
    )
    cym_line.cells[-1].e_smear_after(0, cover_notes=True, extend_beats=3)
    cym_line.events[-1].tag(":32", "mp")
    s.staves["cco_percussion"].segments[-1].append(cym_line)

    counter_me.staves["ooa_mallets"].segments[0].mask("cells", 13, 14, 15, 16,
                                                      17)
    s.extend_from(trumpets, counter_me, wind_swells)

    # FINAL IMPROV

    s.fill_rests(beats=4 * 13)
    improv_winds1 = improv.Improv(sb,
                                  fabric_staves=(
                                      "ooa_flute",
                                      "ooa_clarinet",
                                  ),
                                  improv_times=2,
                                  ranges=pitch_ranges.MID_RANGES,
                                  selectable_start_beat=4 * 13,
                                  dynamic="p")
    improv_winds2 = improv.Improv(
        sb,
        fabric_staves=(
            "ooa_flute",
            "ooa_clarinet",
        ),
        improv_times=2,
        selectable_start_beat=4 * 15,
        ranges=pitch_ranges.MID_RANGES,
        # pitch_selectable_indices = (
        #     (1,3,4),
        #     (0,2,5),
        #     ),
        # dynamic="mp"
    )
    improv_winds2.cells.setattrs(respell="flats")
    s.extend_from(improv_winds1, improv_winds2)

    # counter_winds1 = melody.Melody(
    #     calliope.LineBlock(
    #         COUNTER_LINE_1(),
    #         # COUNTER_LINE_2(),
    #         ),
    #     fabric_staves = ("ooa_flute", "ooa_clarinet",
    #         "cco_flute1", "cco_flute2",
    #         "cco_clarinet1", "cco_clarinet2")
    #     )
    # counter_winds2 = melody.Melody(
    #     calliope.LineBlock(
    #         COUNTER_LINE_2(),
    #         # COUNTER_LINE_2(),
    #         ),
    #     fabric_staves = ("ooa_flute", "ooa_clarinet",
    #         "cco_flute1", "cco_flute2",
    #         "cco_clarinet1", "cco_clarinet2")
    #     )

    # strings_pulse1 = pulse.Pulse(
    #     fabric_staves = (
    #         "cco_violin_ii", "cco_viola"),
    #     pulse_beats = 8*4,
    #     pulse_duration=1,
    #     )
    # strings_pulse2 = pulse.Pulse(
    #     fabric_staves = (
    #         "ooa_violin1","ooa_violin2",
    #         "cco_violin_i","cco_violin_ii","cco_viola"),
    #     pulse_beats = 8*4,
    #     pulse_duration=1,
    #     )

    # cell_bass_line = melody.Melody(
    #     calliope.LineBlock(
    #         calliope.Line(*BASS_LINE()[:-1]),
    #         ),
    #     fabric_staves = ("cco_cello",),
    #     )

    # s.extend_from(
    #     counter_winds1,
    #     strings_pulse1,
    #     cell_bass_line,
    #     )
    # s.fill_rests(fill_to="cco_flute1")

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

    # s.extend_from(
    #     counter_winds2,
    #     strings_pulse2
    #     )
    s.fill_rests()

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

    # s.as_rhythm_and_short()
    s.remove(s.staff_groups["short_score"])

    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 = 12
            main_seg.compress_full_bar_rests = True
Example #23
0
 def as_mod(self, steps=2, scale=None):
     my_mod = self.transformed(
         calliope.TransposeWithinScale(steps=steps, scale=scale),
         calliope.Transpose(interval=5))
     return my_mod
Example #24
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
Example #25
0
def rock4_ooa_trumpet_c43_45(lib):
    l = lib["rock_grid_g4_c43_45"][2]().transformed(
        artics.FuseRepeatedNotes()).t(-1)
    l.events[-6:].transformed(calliope.Transpose(interval=-12))
    return l
Example #26
0
def block0(lib):
    b0 = free_segment.AlocFreeSegmentBlock(tempo_command=""" " 20'' " """)

    clarinets_phrase = lib("intro_line_riff").crop("events", 0,
                                                   3).eps(0, "p", "\\<", "(")(
                                                       2,
                                                       ")",
                                                   )(3,
                                                     "mp",
                                                     "fermata",
                                                     beats=4)()

    b0["ooa_clarinet"].machine_arrow(clarinets_phrase(),
                                     instruction="repeat, freely")

    b0["ooa_horn"].machine(
        ImaginaryCell(rhythm=(4, ), pitches=(-1, )).eps(0, "pp", "\\<")(),
        machine_pad=(0.5, 0.5),
    )
    b0["ooa_horn"].cells[1].events[2].tag(
        "mp")  # tagging skip as cresc. work-around
    b0["ooa_horn"].machine_arrow(lib("cell_rest4"),
                                 with_repeat=False,
                                 machine_pad=(7, 7))

    b0["ooa_trumpet"].machine(
        lib("cell_rest1"),
        machine_pad=(0, 0),
    )
    b0["ooa_trumpet"].machine(
        (lib("intro_line_riff").t(5) +
         lib("intro_line_riff").t(12).crop("events", 0, 1).mask("events", -1) +
         lib("intro_a_phrase_0").t(12).sc(0.5) +
         lib("intro_a_cell_2").t(24)).eps(
             0, "p", "\\<", "cup mute, freely, solo", beats=2)(1, beats=1)(
                 2,
                 "mf",
             )(5, 6,
               beats=0.25)(7, ")",
                           beats=2)(10, "-",
                                    beats=1)(11, "-",
                                             beats=1.5)(23,
                                                        "fermata",
                                                        "\\>",
                                                        beats=2)(0, 2, 6, 8,
                                                                 13,
                                                                 "(")(1, 5, 7,
                                                                      9, 14,
                                                                      ")")()(),
        pad=(0.5, 0),
    )
    b0["ooa_trumpet"].machine_arrow(lib("cell_rest2"), with_repeat=False)
    b0["ooa_trumpet"].cells[-4].events[0].tag("p")

    b0["ooa_bass_guitar"].machine(
        ImaginaryCell(rhythm=(4, ), pitches=(-12, )).eps(0, "mp")(), )
    b0["ooa_bass_guitar"].machine_arrow(
        lib("cell_rest4"),
        # pad=(8,1),
        with_repeat=False,
        machine_pad=(8, 8))

    b0["ooa_mallets"].machine(
        ImaginaryCell(rhythm=(
            -0.5,
            4,
        ), pitches=(
            "R",
            24,
        )).ops("events")(0, "bowed, (motor on)")(1, "fermata", "mp")(), )
    b0["ooa_mallets"].machine_arrow(
        lib("cell_rest4"),
        # pad=(8,1),
        with_repeat=False,
        machine_pad=(7, 7))

    b0["ooa_violins"].machine_arrow(
        lib("intro_phrase_wiggle").t(-7).eps(0, "p")(3,
                                                     "(")(4, ")",
                                                          beats=1)(5,
                                                                   "fermata",
                                                                   beats=2)(),
        instruction=
        "both repeat freely, 2nd starting slightly after 1st (staggered)")

    b0["ooa_cellos"].machine_arrow(ImaginaryCell(rhythm=(4, ),
                                                 pitches=((-1, 0), )).eps(
                                                     0, "tremolo:3")(),
                                   instruction="repeat hairpin, 1,2 staggered")
    b0["ooa_cellos"].eps(1, 5, "ppp")(
        1,
        "\\<",
    )(
        3,
        "mp",
        "\\>",
    )()

    b0["cco_clarinets"].machine_arrow(clarinets_phrase(),
                                      instruction="repeat, freely (staggered)")

    b0["cco_percussion"].machine_arrow(intro.hold_cell(0, "p", ":32",
                                                       "fermata"),
                                       instruction="(cont. repeating)")

    b0["cco_harp"].machine(
        ImaginaryCell(rhythm=(1, ),
                      pitches=((-6, 6, 23, 24), )).ops("events")(0, ">",
                                                                 "ff")(), )
    b0["cco_harp"].machine_arrow(
        lib("cell_rest4"),
        # pad=(8,1),
        with_repeat=False,
        machine_pad=(6, 6))

    b0["cco_violin_i1"].machine_arrow(intro.hold_cell(
        24,
        "p",
    ),
                                      instruction="repeat")

    b0["cco_violin_i2"].machine_arrow(intro.hold_cell(
        18,
        "p",
    ),
                                      instruction="repeat")

    b0["cco_violin_i3"].machine_arrow(lib("intro_cell_down").t(17).eps(
        0, "p", beats=0.5)(),
                                      instruction="repeat")

    b0["cco_violin_i4"].machine_arrow(lib("intro_a_phrase_1").cells[1].eps(
        0, "p")(),
                                      instruction="repeat, freely")

    l_violin_ii1 = lib("intro_rock3_cco_oboe1_c38_41")
    l_violin_ii1.cells[1].pop_from("events", 0)
    l_violin_ii1.cells[1:].transformed(calliope.Transpose(interval=-7))
    l_violin_ii1.eps(0, "\\<")(3, beats=1.5)()
    b0["cco_violin_ii1"].machine_arrow(l_violin_ii1,
                                       instruction="repeat, freely")

    b0["cco_violin_ii2"].machine_arrow(lib("intro_phrase_wiggle").crop(
        "events", 0, 2).t(-7).eps(0, "p")(2, beats=1)(),
                                       instruction="repeat, freely")

    b0["cco_violin_ii3"].machine(lib("cell_rest1"))
    b0["cco_violin_ii3"].machine_arrow(lib("intro_cell_down").t(-2).eps(
        0,
        "p",
    )(),
                                       instruction="repeat, freely")

    b0["cco_violin_ii4"].machine_arrow(lib("intro_cell_shake").t(10).eps(
        0, "p", beats=1)(2, "fermata", beats=2)(),
                                       instruction="repeat, freely")

    # block_0["cco_violin_i4"].machine_arrow(intro.COUNTER_A0().t(17).ops("events")(
    #     0, "p", beats=0.5)(),
    #     instruction="repeat")

    b0["cco_viola1"].machine(lib("cell_rest1"))
    b0["cco_viola1"].machine_arrow(lib("intro_a_phrase_0").eps(
        0,
        "mp",
    )(1, 4, beats=2)(),
                                   instruction="repeat, freely")

    b0["cco_viola2"].machine_arrow(lib("intro_rock3_cco_bassoon_c39_41").crop(
        "events", 1).t(5).eps(0, "p", "\\<")(
            0,
            2,
            "(",
        )(
            1,
            3,
            ")",
        )(5, "mp", beats=4)(),
                                   instruction="repeat, freely")

    b0["cco_viola3"].machine(lib("cell_rest2"))
    b0["cco_viola3"].machine_arrow(lib("intro_cell_shake").t(17).eps(
        0, "p", beats=1)(1, beats=1)(2, "fermata", beats=4, pitch=12)(),
                                   instruction="repeat, freely")

    b0["cco_viola4"].machine(lib("cell_rest1"))
    b0["cco_viola4"].machine_arrow(intro.hold_cell(
        -12,
        "p",
    ),
                                   instruction="repeat")

    b0["cco_cello1"].machine_arrow(lib("intro_cell_mist").eps(0, "p")(),
                                   instruction="repeat, freely")

    b0["cco_cello2"].machine_arrow(
        lib("intro_phrase_straight_i").cells[1].t(-7).eps(0, "p")(
            1,
            3,
            beats=2,
        )(),
        instruction="repeat, freely")

    b0["cco_bass"].machine_arrow(intro.hold_cell(
        -6,
        "p",
    ),
                                 instruction="repeat")

    return b0
Example #27
0
 def t(self, interval):
     """
     shortcut for transposing, since used A LOT
     """
     return self.transformed(calliope.Transpose(interval=interval))
Example #28
0
def rock4_ooa_flute_c43_45(lib):
    l = lib["rock_grid_g4_c43_45"][0]().transformed(
        artics.FuseRepeatedNotes()).t(-25)
    l.events[-3:].transformed(calliope.Transpose(interval=-12))
    return l