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
def cello_pad_score(lib): return pad.Pad(fabric_staves=("cco_cello", ), pad_durations=(4, ) * 8)
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
def score0(lib): s = score.ImaginaryScore() sb = lib("integrate_block0") s = sb().annotate(slur_cells=True, label=("cells", )).to_score(s) # s.extend_from( # # TO DO: re-add harp and piano # # my_harp(), # # my_piano(), # # lib("integrate0_strings_counter_score"), # # lib("integrate0_winds_counter_broken_score"), # # lib("integrate0_cello_pad_score"), # ) s.extend_from( pizz_flutter.PizzFlutter( sb, # ranges=pitch_ranges.MID_RANGES, # selectable_start_beat = 0, pizz_flutter_initial= True, # if True then will add pizz and f.t. indications pizz_flutter_beats=8, bookend_beats=(0, 1), mask_staves=("cco_bass", ), pizz_dynamic="mf", flutter_dynamic="p", )) s.extend_from( pizz_flutter.PizzFlutter( sb, ranges=pitch_ranges.MID_RANGES, # selectable_start_beat = 0, pizz_flutter_beats=7, mask_staves=("cco_bass", )), extend_last_machine=True) # (make the guitars quiter) for st in s.staves["ooa_guitar", "ooa_bass_guitar"]: st.note_events[0].tag("mp") drum_set = ImaginarySegment( ImaginaryCell(rhythm=(-4 * 4, )), lib("drum_off_short").eps( 0, "p", )(), get_improv_line(rhythm=(1, ) * 4, times=8), lib("drum_du_du").eps(0, "mp", "\\<")(13, "mf")(), ) s.staves["ooa_drum_set"].append(drum_set) mallets = pad.Pad( sb.with_only("high_drones"), fabric_staves=("ooa_mallets", ), pad_durations=(4, ) * 10, tag_all_note_events=(":32", ), bookend_beats=(4 * 4, 0), after_func=lambda x: x.eps( 0, "p", )(), ) s.extend_from(mallets) bass_accent_es = (2, 5, 12, 15, 28, 36) bass_accent_es2 = (1, 4, 8, 14, 17) bassoon_undo = lambda_segment.LambdaSegment( sb.with_only("bass_line", ), fabric_staves=("cco_bassoon", ), func=lambda x: x.only_first("cells", 11).crop_chords(indices=(-1, )). eps(0, "mf")(1, 6, 11, 14, 17, 21, 27, 30, 31, 33, 35, 38, "-") (*bass_accent_es, ".", ">")(3, 7, 9, 18, 22, 24, 39, 41, "(") (4, 8, 10, 19, 23, 25, 40, 42, ")")()) bassoon_undo2 = lambda_segment.LambdaSegment( sb.with_only("bass_line", ), fabric_staves=("ooa_bassoon", ), func=lambda x: x.only_last("cells", 5).crop_chords(indices=(-1, )).eps( 0, 3, 10, 16, "-")(*bass_accent_es2, ".", ">")(6, 11, "(") (7, 13, ")")()) tenor_highlights = lambda_segment.LambdaSegment( sb.with_only("bass_line", ), fabric_staves=("ooa_tenor_sax", ), func=lambda x: x.poke("events", *bass_accent_es).crop_chords(indices=( -1, )).smear_after(extend_beats=3).eps(2, "p")()) basson_highlights = lambda_segment.LambdaSegment( sb.with_only("bass_line", ), fabric_staves=("ooa_bassoon", ), func=lambda x: x.only_first("cells", 11).poke( "events", *bass_accent_es).crop_chords(indices=(-1, )). smear_before(extend_beats=3, rearticulate=True).ops("note_events") (0, 2, 4, 6, 8, 10, "p", "\\<")(1, 3, 5, 7, 9, 11, "mf", ".")()) bass_line = lambda_segment.LambdaSegment( sb.with_only("bass_line", ), fabric_staves=("cco_bass", "cco_percussion"), funcs=( lambda x: x.crop_chords(indices=(0, )).t(12).eps(1, "pizz", "mf") (), lambda x: x.only_first("cells", 6).crop_chords(indices=( 0, 1)).smart_ranges( ((-15, -4), ) # ).label("events" ).poke("events", 1, 4, 5, 11, 15, 18, 19).e_smear_after( 1, 11, fill=True).bookend_pad(0, 3).eps( 0, "\\timpStaff", "timpani")(1, 9, "pp", "\\<") (3, 10, "mp")(1, 9, ":32")())) harp = lambda_segment.LambdaSegments( sb.with_only("riff", ), fabric_staves=("harp1", "harp2"), funcs=( lambda x: x.crop("cells", 1).t(12).transformed( calliope.StandardDurations()).eps(0, "mf")(), lambda x: x.crop("cells", 1).transformed( calliope.StandardDurations()).t(-12).eps()(), ), bookend_beats=(4, 0), ) guitars = osti.Osti(sb.with_only("bass_drones"), fabric_staves=( "ooa_bass_guitar", "ooa_guitar", ), ranges=pitch_ranges.MID_RANGES, osti_pulse_duration=1, osti_cell_length=10, osti_cell_count=4, after_func=lambda x: x.eps(0, "disorted")()) sax_counter = lambda_segment.LambdaSegment( sb.with_only("melody_line1"), fabric_staves=("ooa_alto_sax1", ), func=lambda x: x.transformed(artics.FuseRepeatedNotes()).slur_cells( ).eps(1, "mp")()) s.extend_from( bass_line, bassoon_undo, tenor_highlights, basson_highlights, bassoon_undo2, guitars, harp, sax_counter, ) cym_line = ImaginaryLine( ImaginaryCell(rhythm=(1, -3), ).eps(0, ":32", "p", "sus. cym.", "\\percStaff", "(")(1, ")")(), ImaginaryCell(rhythm=(-4 * 8, ), ), ImaginaryCell(rhythm=(4, ), ).eps(0, ":32", "mp", "(sus. cym.)")(), ) s.staves["cco_percussion"].segments[-1].append(cym_line) s.fill_rests(5 * 4) bari_improv = improv.Improv(sb, fabric_staves=("ooa_bari_sax", ), improv_times=5, ranges=pitch_ranges.MID_RANGES, selectable_start_beat=5 * 4, pitch_selectable_indices=((0, 2, 5), ), dynamic="pp") bari_improv.note_events[0].tag("\\<") bari_improv.note_events[9].tag("mp") s.extend_from(bari_improv) oboe_swells = staggered_swell.StaggeredSwells( sb.with_only("mid_drones"), fabric_staves=("cco_oboe1", "cco_oboe2", "cco_flute1", "cco_flute2"), ranges=pitch_ranges.MID_TO_HIGHISH_RANGES, selectable_start_beat=5 * 4, swell_duration=8, # cell_count=2, # phrase_count=2, ) s.extend_from(oboe_swells) s.fill_rests(beats=8 * 4) clarinet_highlights = lambda_segment.LambdaSegments( sb.with_only("bass_line", ), fabric_staves=( "cco_clarinet1", "cco_clarinet2", ), funcs=( lambda x: x.only_last("cells", 5).poke("events", *bass_accent_es2). crop_chords(indices=(-1, )).smear_before( extend_beats=3, rearticulate=True).ops("note_events") (0, 2, 4, 6, 8, "p", "\\<")(1, 3, 5, 7, 9, "mf", ".") (), lambda x: x.only_last("cells", 5).poke( "events", *bass_accent_es2).crop_chords(indices=( -1, )).smear_after(extend_beats=3).eps(1, "p")())) s.extend_from(clarinet_highlights, ) s.fill_rests(beats=10 * 4) brass_improv1 = improv.Improv(sb, fabric_staves=("ooa_horn", "ooa_trumpet", "ooa_trombone"), improv_times=1, ranges=pitch_ranges.MID_RANGES, selectable_start_beat=10 * 4, pitch_selectable_indices=((0, 2, 4), ), dynamic="p") brass_improv2 = improv.Improv( sb, instruction="", fabric_staves=("ooa_horn", "ooa_trumpet", "ooa_trombone"), improv_times=2, ranges=pitch_ranges.MID_RANGES, selectable_start_beat=11 * 4, pitch_selectable_indices=((0, 2, 4), ), # dynamic="p" ) s.extend_from(brass_improv1, brass_improv2) s.fill_rests() # s.lines.apply(lambda x:x.auto_respell()) # s.phrases.apply(lambda x:x.auto_respell()) # 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 = 10 main_seg.compress_full_bar_rests = True
def score3(lib): s = score.ImaginaryScore() sb = lib("integrate_block3") s = sb().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s) drum_set = ImaginarySegment( lib("drum_quick_off2").eps(0, "mp")(), get_improv_line(rhythm=(1, ) * 4, times=6), lib("drum_du_du").eps(0, "\\<")(), lib("drum_rock_out").eps(0, "mf")(), get_improv_line(rhythm=(1, ) * 4, times=5), get_improv_line(instruction="improv", rhythm=(0.5, ) * 8, times=2), ) s.staves["ooa_drum_set"].append(drum_set) # # ================================================ # # STARTING IMPROV improv_winds1 = improv.Improv( sb, fabric_staves=("ooa_flute", "ooa_clarinet", "ooa_alto_sax1", "ooa_alto_sax2"), improv_times=7, # selectable_start_beat=12*4, ranges=pitch_ranges.MID_RANGES, dynamic="mp") improv_winds2 = improv.Improv(sb, fabric_staves=("ooa_tenor_sax", "ooa_bari_sax", "ooa_bassoon"), improv_times=4, selectable_start_beat=3 * 4 + 2, bookend_beats=(3 * 4, 0), ranges=pitch_ranges.TOP_RANGES, pitch_selectable_indices=( (1, 3, 4), (0, 2, 5), ), dynamic="mp") improv_winds3 = improv.Improv(sb, fabric_staves=("ooa_horn", "ooa_trumpet", "ooa_trombone"), improv_times=2, selectable_start_beat=5 * 4, bookend_beats=(5 * 4, 0), ranges=pitch_ranges.TOP_RANGES, pitch_selectable_indices=((0, 1, 3, 4), ), dynamic="mp") s.extend_from( improv_winds1, improv_winds2, improv_winds3, ) counter_me = lambda_segment.LambdaSegments( sb.with_only("counter_line"), fabric_staves=( "cco_flute1", "cco_flute2", "ooa_mallets", "harp1", # "harp2", "cco_oboe1", "cco_oboe2", "cco_clarinet1", "cco_clarinet2", ), func=lambda x: x.crop("cells", 0, 12), funcs=( lambda x: x.only_first("cells", 16).eps()(), lambda x: x.only_first("cells", 16).eps()(), lambda x: x.transformed( calliope.StandardDurations( min_duration=0.25, standard_duration=0.5, )).eps(0, "mf")(), lambda x: x.poke("events", 0, 2, 5, 7, 8, 14, 21, 23, 24, 28, 30, 31).smear_after(min_beats=1, ).stack_p([(0, -12)]) .transformed(calliope.StandardDurations()).eps(0, "mf")(), # lambda x:x.poke("events",0,2,5,7,8,14,21,23,24,28,30,31).smear_after( # min_beats=1, # ).transformed( # calliope.StandardDurations() # ).t(-12)(), lambda x: x.poke( "events", 0, 5, 14, 23, 28, ).smear_before( extend_beats=2, gap_beats=0.5, rearticulate=True, ).smear_after(min_beats=1, ).ops("note_events") (0, 2, 4, 6, 8, "mf", ".")(1, 3, 5, 7, 9, "mp", "\\<")(), lambda x: x.poke( "events", 2, 7, 21, 25, 30, ).smear_after(min_beats=1, ).smear_before( extend_beats=2, gap_beats=0.5, rearticulate=True, ).ops("note_events")(0, 2, 4, 6, 8, "mp", "\\<") (1, 3, 5, 7, 9, "mf", ".")(), lambda x: x.poke( "events", 0, 5, 14, 23, 28, ).smear_before( extend_beats=2, gap_beats=0.5, rearticulate=True, ).smear_after(min_beats=1, ).ops("note_events") (0, 2, 4, 6, 8, "mf", ".")(1, 3, 5, 7, 9, "mp", "\\<")(), lambda x: x.poke( "events", 2, 7, 21, 25, 30, ).smear_after(min_beats=1, ).smear_before( extend_beats=2, gap_beats=0.5, rearticulate=True, ).ops("note_events")(0, 2, 4, 6, 8, "mp", "\\<") (1, 3, 5, 7, 9, "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, )) flourish_flutes = osti.Osti(sb, fabric_staves=("cco_flute1", "cco_flute2"), ranges=pitch_ranges.LOW_TO_HIGH_RANGES, selectable_start_beat=9 * 4, osti_pulse_duration=0.5, osti_cell_length=8, osti_cell_count=1, after_func=lambda x: x.eps(0, "\\<", "(")()) for st in flourish_flutes.staves: st.segments[0].fuse() st.segments[0].note_events[-1].tag(")") # flutes.slur_cells() # violins_melody = lambda_segment.LambdaSegment( # sb.with_only("mid_drones"), # fabric_staves = ("cco_violin_i",), # func = lambda x: x.eps( # 1, "mf")( # 1,5,9,11,13,16,21,23,26,28,30,33,36,40,44,46,48,51,56)( # ).annotate(label=("events",)), # ) cellos_horns_melody = lambda_segment.LambdaSegment( sb.with_only("mid_drones"), fabric_staves=("cco_cello", "cco_horn"), func=lambda x: x.eps(1, "mf")(5, 9, 11, 16, 21, 26, 31, 33, "(") (6, 10, 12, 17, 22, 27, 32, 34, ")") ().crop("cells", 0, 4).t(-12), #.annotate(label=("events",)), ) for st in cellos_horns_melody.staves: for n in st.note_events[2, 5, 10]: n.pitch += 12 violins_end_melody = lambda_segment.LambdaSegment( sb.with_only("mid_drones"), fabric_staves=( "cco_flute1", "cco_flute2", "cco_violin_i", "cco_violin_ii", ), func=lambda x: x.eps(1, "mf")(5, 9, 11, 16, 21, 26, 31, 33, "(") (6, 10, 12, 17, 22, 27, 32, 34, ")") ().crop("cells", 4).crop("events", 3).e_smear_before( 1, extend_beats=0.25, cover_notes=True, ).e_smear_before( 6, extend_beats=0.25, cover_notes=True, ).t(12).eps(1, 6, ">")(), #.annotate(label=("events",)), ) for st in violins_end_melody.staves: st.note_events[0].pitch += 12 st.note_events[0].tag("f") constant_pluck = osti.Osti( sb, fabric_staves=instrument_groups.get_instruments("ooa_strings") + ("ooa_guitar", "ooa_bass_guitar"), ranges=pitch_ranges.HIGHISH_TO_LOW_RANGES, bookend_beats=(4, 0), osti_pulse_duration=0.5, osti_cell_length=8, osti_cell_count=9, after_funcs=( lambda x: x.mask("cells", 0, 1, 2, 3).eps(8 * 4, "mp", "pizz, distorted")(), lambda x: x.mask("cells", 0, 1, 2, 3).eps(8 * 4, "mp", "pizz, distorted")(), lambda x: x.mask("cells", 0, 1).eps(8 * 2, "mp", "pizz, distorted") (), lambda x: x.mask("cells", 0, 1).eps(8 * 2, "mp", "pizz, distorted") (), lambda x: x.eps(0, "mp", "distorted")(), lambda x: x.eps(0, "mp", "distorted")(), )) constant_pluck2 = osti.Osti( sb, fabric_staves=instrument_groups.get_instruments("ooa_strings") + ("ooa_guitar", "ooa_bass_guitar"), ranges=pitch_ranges.LOW_TO_HIGH_RANGES, selectable_start_beat=10 * 4, osti_pulse_duration=1, osti_cell_length=4, osti_cell_count=6, after_func=lambda x: x.eps( 0, "mf", )()) for st in constant_pluck2.staves: if st.name in instrument_groups.get_instruments("ooa_strings"): st.note_events[0].tag("arco") st.note_events.tag(".") measured_trems = osti.Osti( sb, fabric_staves=("cco_violin_i", "cco_violin_ii", "cco_viola"), ranges=pitch_ranges.LOW_TO_HIGHISH_RANGES, osti_pulse_duration=0.5, osti_cell_length=8, osti_cell_count=9, tag_all_note_events=(":16", ), after_funcs=( lambda x: x.mask("cells", 0, 1).ops("cells")(7, "\\<") ().ops("note_events")( 0, "mp", )(), lambda x: x.mask("cells", 0, 1, 2, 3).ops("cells")(7, "\\<") ().ops("note_events")( 0, "mp", )(), lambda x: x.ops("note_events")( 0, "mp", )().ops("cells")(7, "\\<")()(), )) measured_trems2 = osti.Osti( sb, fabric_staves=("cco_viola", "cco_cello"), ranges=pitch_ranges.HIGH_TO_LOW_RANGES, osti_pulse_duration=0.5, osti_cell_length=8, osti_cell_count=8, selectable_start_beat=8 * 4, tag_all_note_events=(":16", ), ) measured_trems2.staves["cco_viola"].segments[0].crop("cells", 1) measured_trems2.staves["cco_viola"].note_events[0].tag("mf") sax_melody = lambda_segment.LambdaSegment( sb.with_only("high_drones"), fabric_staves=instrument_groups.get_instruments( "ooa_winds", "sax", "ooa_brass", ), func=lambda x: x.crop("cells", 4).slur_cells().ops("note_events") (0, "mf")(), bookend_beats=(4, 0), 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 lambda x: x.t(-17), #tbn )) cco_wind_melodies = lambda_segment.LambdaSegment( sb.with_only("melody_line1", "melody_line2"), fabric_staves=( "cco_oboe1", "cco_oboe2", "cco_clarinet1", "cco_clarinet2", ), func=lambda x: x.with_only("cells", 10, 11, 12, 13, 14, 15).slur_cells( ).eps(1, "mf")()) bass_pulse = osti.Osti(sb.with_only("bass_drones"), fabric_staves=("cco_bass", "cco_percussion"), ranges=pitch_ranges.MID_TO_LOW_RANGES, osti_pulse_duration=1, osti_cell_count=16, osti_cell_length=4, after_funcs=( lambda x: x.eps(0, "mp")(28, "\\<")(36, "mf")(), lambda x: x.mask("cells", 0, 1).eps( 8, "mp", "timpani", "\\timpStaff")(), )) bass_pulse.segments[0].smart_ranges([(-19, -6)]) 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, "mf")()) for n in end_doves.staves["cco_horn"].note_events[:7]: n.pitch += 12 end_osti = osti.Osti(sb, fabric_staves=("harp1", "harp2", "piano1", "piano2"), ranges=pitch_ranges.HIGHISH_TO_MID_RANGES, selectable_start_beat=10 * 4, osti_pulse_duration=0.5, osti_cell_length=8, osti_cell_count=6, tag_all_note_events=(">"), after_funcs=( lambda x: x.eps(0, "mf")(), lambda x: x, lambda x: x.eps(0, "mf")(), lambda x: x, )) end_osti.staves["piano2"].segments[0].t(-12) end_roll = pad.Pad(sb.with_only("bass_drones"), fabric_staves=("ooa_mallets", ), ranges=pitch_ranges.HIGHISH_RANGES, selectable_start_beat=10 * 4, pad_durations=(8, 16), after_func=lambda x: x.eps(0, "mf", "\\<", ":32") (1, "f", ":32")()) s.extend_from( counter_me, # trumpets_melody, # clarinets_melody, cellos_horns_melody, constant_pluck, constant_pluck2, bass_pulse, measured_trems, flourish_flutes, violins_end_melody, sax_melody, measured_trems2, extend_last_machine=True) s.fill_rests(beats=10 * 4) s.extend_from(cco_wind_melodies, end_doves, end_osti, end_roll) # trumpets_melody = lambda_segment.LambdaSegment( # sb.with_only("melody_line2"), # fabric_staves = ("ooa_trumpet","cco_trumpet"), # func = lambda x: x.eps( # # 5,9,11,16,21,26,31,33, "(")( # # 6,10,12,17,22,27,32,4, ")")( # ).slur_cells(),#.annotate(label=("events",)), # ) # clarinets_melody = lambda_segment.LambdaSegment( # sb.with_only("melody_line1"), # fabric_staves = ("ooa_clarinet","cco_clarinet1","cco_clarinet2"), # func = lambda x: x.eps( # 1, "mf")( # # 5,9,11,16,21,26,31,33, "(")( # # 6,10,12,17,22,27,32,4, ")")( # ).slur_cells(),#.annotate(label=("events",)), # ) # my_piano = sus_piano.SusPiano1( # sus_duration=8*4, # accents = ( # (0, 3, 6, 8, 10, 12), # (0, 2,), # ) # ) # my_harp = sus_piano.SusPiano1( # sus_duration=8*4, # fabric_staves = ("harp1", "harp2",), # accents = ( # (0, 3, 6, 8, 10, 12), # (0, 2,), # ) # ) # strings_counter = melody.Melody( # calliope.LineBlock( # COUNTER_LINE_1(), # ), # fabric_staves = ("cco_violin_i", "cco_violin_ii", "cco_viola",) # ) # counter_line_broken = COUNTER_LINE_1() # print(counter_line_broken) # counter_line_broken.transformed(calliope.Poke( # selection=counter_line_broken.note_events[0,1, 2,3,5,6,7,8] # )) # # TO DO: continue this shaping # winds_counter_broken = melody.Melody( # calliope.LineBlock( # counter_line_broken, # ), # fabric_staves = ("cco_clarinet1","cco_clarinet2") # ) # # TO DO: need pitches: # cello_pad = pad.Pad( # fabric_staves = ("cco_cello",), # pad_durations = (4,)*8 # ) # pop_fizz1 = pizz_flutter.PizzFlutter( # pizz_flutter_initial = True, # pizz_flutter_beats = 3, # mask_staves = ("harp1", "harp2"), # ) # pop_fizz2 = pizz_flutter.PizzFlutter( # pizz_flutter_beats = 3, # mask_staves = ("harp1", "harp2"), # bookend_beats = (0,2) # ) # s.extend_from( # my_harp, # my_piano, # pop_fizz1, # ) # s.extend_from( # pop_fizz2, # extend_last_machine = True, # ) # s.fill_rests() # ======================================================= # bars 9-16 # s.extend_from( # my_harp(), # my_piano(), # strings_counter, # winds_counter_broken, # cello_pad, # ) s.lines.setattrs(respell="flats") s.phrases.setattrs(respell="flats") 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] main_seg.tempo_command = """ Gradual Accel. ... """ for next_seg in list(segs[1:]): main_seg.extend(next_seg) next_seg.parent.remove(next_seg) main_seg.rehearsal_mark_number = 14 main_seg.compress_full_bar_rests = True
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
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
x = osti.Osti( sb, fabric_staves=instrument_groups.get_instruments("strings"), ranges=pitch_ranges.MID_RANGES, # selectable_start_beat = 0, # osti_pulse_duration = 0.5, # osti_cell_length = 6, # osti_cell_count = 2, ) # calliope.illustrate(x) # ====================================================================== # PAD x = pad.Pad( sb, fabric_staves=instrument_groups.get_instruments("strings"), ranges=pitch_ranges.MID_RANGES, # selectable_start_beat = 0, # pad_durations = (4,)*4, ) # x = pad.MalletsPad(sb) # calliope.illustrate(x) # ====================================================================== # PIZZ FLUTTER x = pizz_flutter.PizzFlutter( sb, # fabric_staves = instrument_groups.get_instruments("strings"), ranges=pitch_ranges.MID_RANGES, # selectable_start_beat = 0, # pizz_flutter_initial = False, # if True then will add pizz and f.t. indications # pizz_flutter_beats = 4, )