def weave(self, staff, index=0, **kwargs): my_machine = self.selectable.get_cyclic(index)() if not isinstance(my_machine, ImaginarySegment): my_machine = ImaginarySegment(my_machine) if self.func: my_machine = self.func(my_machine) if self.funcs: my_machine = self.funcs[index % len(self.funcs)](my_machine) return my_machine
def gliss_up_block(rest_beats=-1, low_beats=3, high_beats=4, transpose=0, tags=()): return calliope.SegmentBlock( ImaginarySegment( ImaginaryCell( rhythm=(rest_beats, low_beats, high_beats), pitches=("R", 16 + transpose, 27 + transpose), respell="sharps", ).eps( 0, "speed up into tremolo", )(1, "!\\glissando :8", "\\<", *tags)(2, "ff", ":32")()))
def fill_rests(self, beats=None, fill_to=None, include_short_score=False, only_staves=(), **kwargs): if only_staves: my_staves = list(self.staves[only_staves]) elif include_short_score: my_staves = list(self.staves) else: short_staves = list(self.staff_groups["short_score"].staves) my_staves = [s for s in self.staves if s not in short_staves] staves_beats = [sum([m.beats for m in s]) for s in my_staves] if fill_to: beats = beats or sum([m.beats for m in self.staves[fill_to]]) beats = beats or max(staves_beats) for staff, staff_beats in zip(my_staves, staves_beats): if staff_beats < beats: if staff.segments: staff.segments[-1].append( ImaginaryLine(rhythm=(staff_beats-beats,)) ) else: staff.append( ImaginarySegment( ImaginaryLine(rhythm=(staff_beats-beats,)) ) )
def score1(lib): s = score.ImaginaryScore() sb = lib("integrate_block1") s = sb().annotate(slur_cells=True, label=( "phrases", "cells", )).to_score(s) # drum_off_cell.note_events[1].tag("brushes") # drum_on_off_cell.note_events.tag("note_head:0:cross") # drum_on_off_cell.note_events.tag("note_head:1:cross") drum_set = ImaginarySegment( lib("drum_on_off"), get_improv_line(rhythm=(1, ) * 8, times=7).ops("cells")(6, "\\<")(), get_improv_line(instruction="improv, solo", rhythm=(0.5, ) * 8, times=1).eps(0, "mf")(), ) s.staves["ooa_drum_set"].append(drum_set) string_staves = ( "ooa_violin1", "ooa_violin2", "ooa_cello1", "ooa_cello2", "cco_violin_i", "cco_violin_ii", "cco_viola", "cco_cello", ) s.extend_from( pulse_on_off_beat.PulseOnOffBeat( sb, fabric_staves=string_staves, phrase_beats=(8, ) * 8, ranges=pitch_ranges.LOW_TO_HIGHISH_RANGES, ), ) # CCO cello and viola come in first ... then for st in s.staves["ooa_cello1", "ooa_cello2"]: st.segments[0].mask("cells", 0, 1) for st in s.staves["cco_violin_i", "cco_violin_ii", ]: st.segments[0].mask( "cells", 0, 1, 2, 3, ) for st in s.staves["ooa_violin1", "ooa_violin2"]: st.segments[0].mask("cells", 0, 1, 2, 3, 4, 5) timp_seg = s.staves["cco_cello"].segments[0]() for n in timp_seg.note_events: if not n.pitch in (-22, -15, -10): n.pitch = "R" timp_seg.cells[12, 13].note_events.tag(">") timp_seg.transformed(calliope.StandardDurations()).eps( 0, "\\timpStaff", "timpani", "p")() s.staves["cco_percussion"].append(timp_seg) for st in s.staves[string_staves]: st.note_events[0].tag("arco", "p") st.phrases[3].e_smear_after(0, cover_notes=True, extend_beats=3.5).eps(0, "\\<")() st.cells[7].tag("mf") st.cells[13].e_smear_after(0, extend_beats=2.5, cover_notes=True).eps(0, "\\mp", "\\<")()() st.cells[13].eps(1, "mf", ">", ".")() st.cells[14].eps(0, ">", ".")() bass_seg = s.staves["cco_cello"].segments[0]() for n in bass_seg.cells[4:].note_events: n.pitch = sb.pitches_at(n.beats_before(bass_seg))[0] + 12 for c in bass_seg.cells[14:]: c.t(1) s.staves["cco_bass"].append(bass_seg) s.extend_from( lambda_segment.LambdaSegments( sb.with_only("bass_line", ), fabric_staves=("ooa_bassoon", "cco_bassoon"), funcs=( lambda x: x.crop_chords(indices=(0, 1)).crop("cells", 0, 1), lambda x: x.crop_chords(indices=(1, 0)).crop("cells", 0, 1), ), tag_all_note_events=("-", ))) s.extend_from( lambda_segment.LambdaSegments( sb.with_only("melody_line1"), fabric_staves=("harp1", "harp2"), funcs=( lambda x: x.crop_chords(indices=(1, )).ops("note_events") (0, "mp")(), lambda x: x.crop_chords(indices=(0, )).t(-12), ), )) # s.extend_from( # lambda_segment.LambdaSegments( # sb.with_only("counter_line"), # # assign_pitches_from_selectable = True, # fabric_staves = ("piano1","piano2"), # func = lambda x: x.transformed( # calliope.StandardDurations( # min_duration=0.25, # standard_duration=0.5,) # ).e_smear_after(4, cover_notes=True, extend_beats=1 # ).e_smear_after(6, cover_notes=True, extend_beats=0.5 # ).e_smear_after(8, cover_notes=True, extend_beats=0.5 # ).e_smear_after(10, cover_notes=True, extend_beats=0.5 # ).e_smear_after(16, cover_notes=True, extend_beats=0.5 # ).e_smear_after(19, cover_notes=True, extend_beats=0.5 # ).e_smear_after(22, cover_notes=True, extend_beats=0.5 # ).e_smear_after(29, cover_notes=True, extend_beats=0.5 # ).e_smear_after(33, cover_notes=True, extend_beats=0.5 # ).e_smear_after(35, cover_notes=True, extend_beats=0.5 # ).e_smear_after(46, cover_notes=True, extend_beats=0.5 # ).e_smear_after(86, cover_notes=True, extend_beats=0.5 # ).mask("events",24,25,27,31 # ).mask("cells",26,27,29,31).slur_cells(#).label("events","cells" # ), # funcs = ( # lambda x: x.crop_chords(indices=(1,)).transformed( # calliope.SmartRange( # smart_range = (12,26), # ) # ), # lambda x: x.crop_chords(indices=(0,)).t(-12).transformed( # ), # ) # ) # ) # harp_piano_combo = calliope.CompositeChordsLine( # calliope.LineBlock( # ImaginaryLine(*s.staves["harp2"].cells.copy()), # ImaginaryLine(*s.staves["piano2"].cells.copy())), # ).transformed(artics.GroupByBeats()) # s.staves["ooa_mallets"].append(ImaginarySegment(harp_piano_combo)) # s.extend_from( # lambda_segment.LambdaSegments( # sb.with_only("melody_line2"), # fabric_staves = ("piano1","piano2"), # funcs = ( # lambda x: x.crop_chords(indices=(1,)), # lambda x: x.crop_chords(indices=(0,)).t(-12), # ), # ) # ) guitars = osti.Osti( sb.with_only("bass_drones"), fabric_staves=( "ooa_bass_guitar", "ooa_guitar", ), ranges=pitch_ranges.MID_RANGES, osti_pulse_duration=1, osti_cell_length=16, osti_cell_count=4, ) s.extend_from( staggered_swell.StaggeredSwells( sb.with_only("high_drones"), fabric_staves=("ooa_flute", "cco_flute1", "cco_flute2"), low_dynamic="p", swell_dynamic="mf", swell_duration=8, cell_count=2, phrase_count=4, ), guitars, ) harp_lh = s.staves["harp2"].segments[0] for n in harp_lh.note_events: pitches_at_sb = sb.pitches_at(n.beats_before(harp_lh)) n.pitch = (pitches_at_sb[1], pitches_at_sb[-4]) harp_lh.smart_ranges([(-14, 4)]) # now remove dupes for n in harp_lh.note_events: n.pitch = set(n.pitch) for c in harp_lh.cells: c.mask("note_events", -1, -2) harp_lh.transformed(calliope.StandardDurations()) piano_rh = ImaginarySegment( ImaginaryLine( ImaginaryCell(rhythm=(-4, )), ImaginaryPhrase( ImaginaryCell(rhythm=(0.25, 1.75) * 2), ImaginaryCell(rhythm=(2, ) * 4), ) * 4, )) piano_lh = harp_lh() mallets = piano_rh() for n in mallets.note_events: n.pitch = sb.pitches_at(n.beats_before(mallets))[-3] s.staves["ooa_mallets"].append(mallets) mallets.eps(1, "mp")(8, 16, 22, 24, 30, ":32")() for n in piano_rh.note_events: if n.beats == 0.25: n.pitch = sb.pitches_at(n.beats_before(piano_rh))[-2] n.tag("(") elif n.beats == 1.75: n.pitch = sb.pitches_at(n.beats_before(piano_rh))[-1] n.tag(")") else: n.pitch = set(sb.pitches_at(n.beats_before(piano_rh))[-2:]) for n in piano_lh.note_events: n.pitch = sb.pitches_at(n.beats_before(piano_lh))[1] piano_lh.fuse().slur_cells() for n in piano_lh.note_events: n.pitch = set(sb.pitches_at(n.beats_before(piano_lh))[1:3]) s.staves["piano1"].append(piano_rh) s.staves["piano2"].append(piano_lh) s.fill_rests(beats=15 * 4) final_swell_sax_brass = swell_hit.SwellHit( sb.with_only("chords"), fabric_staves=instrument_groups.get_instruments( "sax", "brass", ), ranges=pitch_ranges.HIGHISH_RANGES, selectable_start_beat=15 * 4, low_dynamic="p", hit_dynamic="mf", swell_duration=7, hit_duration=1, hit_rest=0, hit_articulations=("-", )) s.extend_from(final_swell_sax_brass) s.fill_rests(beats=16 * 4) final_swell_winds_strings = swell_hit.SwellHit( sb.with_only("chords"), fabric_staves=instrument_groups.get_instruments( "winds", "strings", ), ranges=pitch_ranges.HIGHISH_RANGES, selectable_start_beat=16 * 4, low_dynamic="mp", hit_dynamic="f", swell_duration=3, hit_duration=1, hit_rest=0, hit_articulations=("-", )) s.extend_from(final_swell_winds_strings) # s.extend_from(final_block) s.fill_rests(fill_to="cco_violin_i") # s.only_staves("piano1", "piano2") # s.as_rhythm_and_short() # s.only_staves(*instrument_groups.get_instruments("cco_strings")) s.fill_rests() s.remove(s.staff_groups["short_score"]) # s.lines.apply(lambda x:x.auto_respell()) # s.phrases.apply(lambda x:x.auto_respell()) for staff in s.staves: # staff.phrases.transformed(calliope.Label()) # staff.lines.transformed(calliope.Label()) # TO DO: WHY DOESN'T THIS WORK????? if segs := staff.segments: main_seg = segs[0] for next_seg in list(segs[1:]): main_seg.extend(next_seg) next_seg.parent.remove(next_seg) main_seg.rehearsal_mark_number = 11 main_seg.compress_full_bar_rests = True
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
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 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
def score2(lib): s = score.ImaginaryScore() sb2 = lib("lyrical_block2") s = sb2().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s) drum_off_cell = ImaginaryCell( rhythm=( 0.25, 0.25, -0.5, ) + (0.5, 0.25, 0.25, -1) * 3 + (1, ), pitches=( (-8, 9), 9, "R", ) + (9, (-8, 5), 4, "R") * 3 + ((-8, 9), ), ) # drum_off_cell.note_events[1].tag("brushes") # drum_off_cell.annotate(label=("note_events",)) drum_off_cell.note_events[0, 1, 2, 3, 5, 6, 8, 9, 11].tag("note_head:0:cross") drum_off_cell.note_events[0, 11].tag("note_head:1:cross") drum_offs = ImaginarySegment( drum_off_cell, get_improv_line(rhythm=(1, ) * 8, times=2), get_improv_line(instruction="improv", rhythm=(0.5, ) * 16, times=1), drum_off_cell, get_improv_line(instruction="improv", rhythm=(0.5, ) * 16, times=1), ) sus_swell_cell = ImaginaryCell(rhythm=(6.5, 0.5, -1), ).eps(0, ":32", "p", "\\<")( 1, ":32", "mp", )() cym_seg = ImaginarySegment( # TO DO... this would be good in the library... ImaginaryCell(rhythm=(1, -3), ).eps(0, ":32")(), ImaginaryCell(rhythm=(-4 * 3, )), sus_swell_cell().eps(2, "* dampen")(), ImaginaryCell(rhythm=(-4 * 2, )), sus_swell_cell().eps(2, "*")(), sus_swell_cell().eps(2, "*")(), ) cym_seg.events[2, 5].tag(")") s.staves["cco_percussion"].append(cym_seg) s.staves["ooa_drum_set"].append(drum_offs) harp_guitar = lambda_segment.LambdaSegments( sb2.with_only("melody_line1", ), fabric_staves=("harp1", "ooa_guitar"), funcs=( lambda x: x.only_first( "cells", 4, ).eps(1, "mf")(), lambda x: x.only_first( "cells", 4, ).eps(1, "mp", "distorted")(), )) s.extend_from(harp_guitar) harp_end = lambda_segment.LambdaSegment( sb2.with_only("high_drones", ), fabric_staves=("harp1", ), func=lambda x: x.with_only("cells", 8, 9, 10, 11).t(-12), ) s.extend_from(harp_end) flute_swells_args = dict( ranges=pitch_ranges.MID_RANGES, fabric_staves=( "cco_flute1", "cco_flute2", ), low_dynamic="p", hit_dynamic="mf", hit_duration=0.5, hit_rest=1, ) cco_flute_swell1 = swell_hit.SwellHit( sb2.with_only("melody_line1", ), **flute_swells_args, bookend_beats=(1, 0), swell_duration=5.5, selectable_start_beat=0.5, ) cco_flute_swell2 = swell_hit.SwellHit( sb2.with_only("melody_line1", ), **flute_swells_args, bookend_beats=(2, 0), swell_duration=4.5, selectable_start_beat=4 * 2 + 2.5, ) cco_flute_swell3 = swell_hit.SwellHit( sb2.with_only("melody_line1", ), **flute_swells_args, bookend_beats=(1, 0), swell_duration=5.5, selectable_start_beat=4 * 4 + 0.5, ) cco_flute_swell4 = swell_hit.SwellHit( sb2.with_only("melody_line1", ), **flute_swells_args, bookend_beats=(1, 0), swell_duration=5.5, selectable_start_beat=4 * 6 + 0.5, ) s.extend_from(cco_flute_swell1, cco_flute_swell2, cco_flute_swell3, cco_flute_swell4, extend_last_machine=True) # TO DO: add ranges # ======================================================= # melody and bass lines: violin_i1 = lambda_segment.LambdaSegment( sb2.with_only("counter_line", ), fabric_staves=("cco_violin_i", ), func=lambda x: x.with_only("cells", 0, 1, 2, 3).eps(0, 3, 5, 8, "(") (1, 4, 6, 9, ")")(), # tag_events = {0:("p", "normal")}, ) violin_i2 = lambda_segment.LambdaSegment( sb2.with_only("melody_line1", ), fabric_staves=("cco_violin_i", ), func=lambda x: x.with_only( "phrases", 1, ).crop_chords(indices=(0, ), ).smart_ranges(((7, 19), )).t(12)) # tag_events = {0:("p", "normal")}, # TO DO: should be able to combine violin i, ii into one statement violin_ii = lambda_segment.LambdaSegment( sb2.with_only("melody_line1", ), bookend_beats=(16, 0), fabric_staves=("cco_violin_ii", ), func=lambda x: x.with_only( "phrases", 1, ).crop_chords(indices=(1, ), ).smart_ranges(((14, 26), )), # tag_events = {0:("p", "normal")}, ) # TO DO: not great... viola = lambda_segment.LambdaSegment( sb2.with_only("melody_line1", ), fabric_staves=("cco_viola", ), func=lambda x: x.with_only("cells", 0, 1).crop_chords(( 0, 0, 1, 0, 0, 0, 0, 1, )).smart_ranges(((0, 12), ), ), # tag_events = {0:("p", "normal")}, ).extend_from( lambda_segment.LambdaSegment( sb2.with_only("counter_line", ), fabric_staves=("cco_viola", ), func=lambda x: x.with_only("cells", 4, 5, 6, 7).smart_ranges( ((-3, 12), ), ))) s.extend_from(violin_i1, violin_i2, violin_ii, viola) # ======================================================= # general textures: # TO DO: this pattern is used often ... DRY s.extend_from( lambda_segment.LambdaSegment( sb2.with_only("high_drones", "bass_drones"), fabric_staves=("piano1", "piano2"), func=lambda x: x, )) s.extend_from( lambda_segment.LambdaSegments(sb2.with_only("bass_drones"), fabric_staves=( "cco_bass", "ooa_bass_guitar", ), funcs=( lambda x: x.crop_chords( (0, ), ).eps(0, "arco", "mp")(), lambda x: x.t(12).eps(0, "p")(), ))) ooa_strings_pulses = pulse_on_off_beat.PulseOnOffBeat( sb2, fabric_staves=( "ooa_violin1", "ooa_violin2", "ooa_cello1", "ooa_cello2", ), phrase_beats=(8, ) * 6, ranges=pitch_ranges.LOW_TO_HIGHISH_RANGES, ) for st in ooa_strings_pulses.staves["ooa_violin1", "ooa_violin2"]: st.segments[0].mask("phrases", 0, 1) for st in ooa_strings_pulses.staves: st.note_events[0].tag("arco") for phrase in st.phrases: if phrase.note_events: phrase.note_events[0].tag(".", "p", "\\<") phrase.note_events[1:].tag("-") phrase.note_events[-1].tag("mf") s.extend_from(ooa_strings_pulses, ) # ======================================================= s.fill_rests(beats=16) # ======================================================= # TO DO: this pitch assignment doesn't work well because # it always chooses top note (due to swell staggering) # TO FIX... make assign_pitches smart enough to know if pitch # already assigned from held over note s.extend_from( lyrical.SaxSwell( sb2, selectable_start_beat=16, ranges=pitch_ranges.get_ranges(ratio_mid=0.6, spread=16), ), lyrical.SaxSwell(sb2, selectable_start_beat=24, ranges=pitch_ranges.get_ranges(ratio_mid=0.6, spread=16), low_dynamic="p", swell_dynamic="mf"), ) mallets_pad = pad.MalletsPad(sb2, pad_durations=(2, ) * 8, selectable_start_beat=16) mallets_pad.segments[0].fuse() mallets_pad.note_events[0].tag("p", "\\<") s.extend_from(mallets_pad) s.extend_from( lambda_segment.LambdaSegment( sb2.with_only("high_drones"), fabric_staves=("ooa_mallets", ), func=lambda x: x.with_only("cells", 8, 9, 10, 11).t(-12).eps( 0, "mf")(), ), extend_last_machine=True, ) # adjust for bass 8va for bass_seg in s.staves["cco_bass"].segments: bass_seg.t(12) s.fill_rests(beats=6 * 4) brass_improv1 = improv.Improv( sb2, fabric_staves=instrument_groups.get_instruments("ooa_brass"), improv_times=2, ranges=pitch_ranges.HIGHISH_RANGES, selectable_start_beat=6 * 4 + 2, dynamic="p", after_func=lambda x: x.eps(0, "\\<")()) brass_improv2 = improv.Improv( sb2, instruction="", fabric_staves=instrument_groups.get_instruments("ooa_brass"), improv_times=2, ranges=pitch_ranges.HIGHISH_RANGES, selectable_start_beat=8 * 4 + 2, dynamic="mf", ) brass_improv3 = improv.Improv( sb2, instruction="", fabric_staves=instrument_groups.get_instruments("ooa_brass"), improv_times=2, ranges=pitch_ranges.HIGHISH_RANGES, selectable_start_beat=10 * 4 + 5, ) s.extend_from(brass_improv1, brass_improv2, brass_improv3) s.fill_rests(beats=32) # ======================================================= cello_viola_melody = lambda_segment.LambdaSegment( sb2.with_only("melody_line1", ), fabric_staves=("cco_viola", "cco_cello"), func=lambda x: x.with_only("cells", 4, 5, 6, 7).crop_chords( (0, )).eps(1, "mf")( 5, 9, 11, "(", )(6, 10, 12, ")")(), ) s.extend_from(cello_viola_melody) end_violins = swell_hit.SwellHit( sb2.with_only("high_drones"), fabric_staves=("cco_violin_i", "cco_violin_ii"), ranges=pitch_ranges.HIGHISH_RANGES, selectable_start_beat=8 * 4, low_dynamic="p", hit_dynamic="f", swell_duration=14.5, hit_duration=0.5, hit_rest=1, ) for st in end_violins.staves: st.note_events[0].tag(":32") s.extend_from(end_violins) # ======================================================= # s.fill_rests(beats=32) # ======================================================= # s.extend_from( # lyrical.OoaStringsPad(), # lyrical.OoaStringsPad(), # ) # s.extend_from( # lyrical.SaxSwell(),lyrical.SaxSwell(),lyrical.SaxSwell(), # ) # s.fill_rests(fill_to="ooa_alto_sax1") # ======================================================= # s.extend_from( # lyrical.PausePizzFlutter( # pizz_flutter_initial = True, # pizz_flutter_beats = 2, # mask_staves=("cco_violin_i","cco_violin_ii"), # ), # ) # s.extend_from( # lyrical.PausePizzFlutter( # pizz_flutter_beats = 6, # extend_last_machine = True, # mask_staves=("cco_violin_i","cco_violin_ii"), # ), # ) # s.fill_rests(beats=12 * 4) # s.remove_empty() s.fill_rests() for staff in s.staves: if segs := staff.segments: main_seg = segs[0] for next_seg in list(segs[1:]): main_seg.extend(next_seg) next_seg.parent.remove(next_seg) main_seg.rehearsal_mark_number = 4 main_seg.auto_respell() main_seg.compress_full_bar_rests = True
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("rock_block0") s = sb().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s) # TO DO: add ranges # ======================================================= low_drums = lambda_segment.LambdaSegment( sb.with_only("bass_rhythm"), fabric_staves=("ooa_drum_set", ), tag_events={0: ("mp", "sticks")}, func=lambda x: x.only_first("cells", 2)) cowbell = lambda_segment.LambdaSegment( sb.with_only("high_rhythm"), fabric_staves=("cco_percussion", ), tag_events={0: ("mp", "to cowbell")}, func=lambda x: x.eps(0, "\\percStaff")().ops("note_events") (0, "cowbell", "mp")(), # func = lambda x: x.only_first("cells",8) ) cowbell.note_events.setattrs(pitch=0) low_drums.staves["ooa_drum_set"].segments[0].append( get_improv_line(rhythm=(1, ) * 8, times=3)) harp_piano_highlights = lambda_segment.LambdaSegments( sb.with_only("counter_line", "riff"), fabric_staves=("harp1", "harp2", "piano1", "piano2"), funcs=( lambda x: x.ops("note_events")(0, "mp")(), lambda x: x.poke("cells", 9, 10, 12, 13).ops("note_events") (0, "treble")(), )) s.extend_from(low_drums, cowbell, harp_piano_highlights) s.fill_rests(beats=8 * 4) # # ======================================================= s.extend_from( lambda_segment.LambdaSegment( calliope.SegmentBlock( ImaginarySegment(lib("rock_rhythm1"), get_improv_line(rhythm=(1, ) * 8, times=11))), fabric_staves=("ooa_drum_set", ), func=lambda x: x, )) s.fill_rests(beats=16 * 4) # # ======================================================= guitar = lambda_segment.LambdaSegment( sb.with_only("riff"), fabric_staves=("ooa_guitar", ), tag_events={0: ("mp", )}, func=lambda x: x.crop("cells", 1), # func = lambda x: x.only_first("cells",8) ) for c in guitar.staves["ooa_guitar"].cells[13:]: c.t(-12) pizz = lambda_segment.LambdaSegment( sb.with_only("chords"), ranges=pitch_ranges.MID_RANGES, fabric_staves=instrument_groups.get_instruments("strings"), mask_staves=("cco_bass", ), tag_events={0: ( "mf", "pizz", )}, assign_pitches_from_selectable=True, selectable_start_beat=16 * 4, func=lambda x: x.crop("cells", 1).ops("note_events") (0, 4, "!\\snappizzicato")(), ) s.extend_from( guitar, pizz, ) # # ======================================================= # TO DO... add in piano and harp sections s.fill_rests(beats=22 * 4) 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, selectable_start_beat=22 * 4, func=lambda x: x.with_only("cells", 11, 12, 13, 14, 15).mask( "cells", 0).ops("note_events")(0, "mp")(), tag_all_note_events=(".", ), bookend_beats=(0, 1)) s.extend_from(wind_hits, ) # # ======================================================= # block for cell 11 minor chord cloud cloud_11 = lib("rock_grid_g0_c11") cloud_11[3].t(12) wind_block_11 = lambda_segment.LambdaSegment( cloud_11, fabric_staves=( "cco_oboe2", "cco_clarinet1", "cco_flute2", "cco_flute1", "cco_oboe1", "cco_clarinet2", ), tag_events={ 0: ( "p", "\\<", ), 5: ("mf", ) }, # assign_pitches_from_selectable = True, # selectable_start_beat = 16*4, func=lambda x: x.slur_cells().bookend_pad(0, 1), # func = lambda x: x.crop("cells",1), # func = lambda x: x.only_first("cells",8) ) wind_block_11.phrases.setattrs(respell="flats") s.extend_from(wind_block_11, ) s.fill_rests(beats=23 * 4) cloud_13 = lib("rock_grid_g0_c13") cloud_13[0].t(-12) cloud_13[1].t(-12) cloud_13[4].t(12) wind_block_13 = lambda_segment.LambdaSegment( cloud_13, fabric_staves=( "cco_trombone", #0 "cco_bassoon", #1 "cco_clarinet2", #2 "cco_flute2", #3 "cco_flute1", #4 "cco_oboe2", #5 "cco_oboe1", #6 "cco_clarinet1", #7 "cco_trumpet", #8 ), tag_events={ 1: ( "p", "\\<", ), 6: ("mf", ) }, # assign_pitches_from_selectable = True, # selectable_start_beat = 16*4, # ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ), 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_block_13.phrases.setattrs(respell="flats") wind_block_13.staves["cco_clarinet2", "cco_trumpet"].phrases.setattrs(respell="sharps") s.extend_from(wind_block_13, ) s.fill_rests(beats=25 * 4) # TO DO... add swell hits here... s.fill_rests(beats=23 * 4) # # ======================================================= 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.crop("cells", 1), tag_events={0: ("mf", )}, ) s.extend_from(bass_drones) s.fill_rests(beats=29 * 4) # # ======================================================= # TO DO: this cloud is not lovely!! cloud_21_22 = lib("rock_grid_g0_c21_22") cloud_21_22[7].t(-12) cloud_21_22[8].t(-12) # cloud_21_22[4].t(12) wind_cloud_21_22 = lambda_segment.LambdaSegment( cloud_21_22, fabric_staves=( "cco_flute1", #0 "cco_flute2", #1 "cco_oboe1", #2 "cco_oboe2", #3 "cco_clarinet1", #4 "cco_clarinet2", #5 "cco_trumpet", #6 "cco_bassoon", #7 "cco_trombone", #8 ), # selectable_start_beat = 16*4, # ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ), func=lambda x: x.fuse().slur_cells().bookend_pad(2).eps( 1, "mp", "\\<")(), ) for st in wind_cloud_21_22.staves: st.note_events[-1].tag("f") wind_cloud_21_22.phrases.setattrs(respell="flats") s.extend_from(wind_cloud_21_22, ) s.fill_rests() for staff in s.staves: if staff.segments: staff.segments[ 0].tempo_command = """ \\note #"4" #UP "= 160 ca" """ staff.segments[0].rehearsal_mark_number = 6 s.segments.setattrs(compress_full_bar_rests=True) s.midi_tempo = 160 return s
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 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
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 score1(lib): s = score.ImaginaryScore() sb1 = lib("lyrical_block1") s = sb1().annotate(slur_cells=True, label=("phrases", "cells")).to_score(s) # ======================================================= # TO DO... adjust ranges: pop_fizz_beats = (2, 4, 2) s.extend_from(*[ pizz_flutter.PizzFlutter( sb1, pizz_flutter_initial=i == 0, pizz_flutter_beats=beats, selectable_start_beat=i * sum(pop_fizz_beats[0:i]), ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ), ) for i, beats in enumerate(pop_fizz_beats) ], extend_last_machine=True) drum_off_cell = ImaginaryCell( rhythm=( 0.25, 0.25, -0.5, ) + (0.5, 0.5, -1) * 3 + (1, ), pitches=( (-8, 9), 9, "R", ) + (9, -8, "R") * 3 + ((-8, 9), ), ) # drum_off_cell.note_events[1].tag("brushes") drum_off_cell.note_events.tag("note_head:0:cross") drum_off_cell.note_events.tag("note_head:1:cross") drum_off_cell.note_events[0].tag("mallets") drum_end_cell1 = ImaginaryCell( rhythm=( 0.25, 0.25, -0.25, 0.25, -0.5, 0.5, -0.5, 0.5, -0.5, 0.25, 0.25, ), pitches=( (-8, 9), 9, "R", 9, "R", (-8, 9), "R", (-8, 9), "R", 9, 9, ), ) drum_end_cell1.note_events.tag("note_head:0:cross") drum_end_cell1.note_events.tag("note_head:1:cross") drum_end_cell2 = ImaginaryCell( rhythm=( 0.25, 0.25, 0.25, -0.25, -0.5, 0.5, -0.5, 0.5, -0.5, 0.25, 0.25, ), pitches=( 9, 9, 9, "R", "R", (-8, 9), "R", (-8, 9), "R", 9, 9, ), ) drum_end_cell2.note_events.tag("note_head:0:cross") drum_end_cell2.note_events.tag("note_head:1:cross") drum_offs = ImaginarySegment( ImaginaryCell(rhythm=(-8, )), drum_off_cell, get_improv_line(rhythm=(1, ) * 8, times=3), drum_end_cell1, drum_end_cell2, ) s.staves["ooa_drum_set"].append(drum_offs) cym_seg = ImaginarySegment( calliope.Cell(rhythm=(-2 * 4, ), ), calliope.Cell(rhythm=(1, -3), ), calliope.Cell(rhythm=(-3 * 4, ), ), calliope.Cell(rhythm=(1, -3), ), calliope.Cell(rhythm=(-5 * 4, ), ), ) cym_seg.note_events.tag(":32", "(") cym_seg.events[2, 5].tag(")") s.staves["cco_percussion"].append(cym_seg) intro_melody = lambda_segment.LambdaSegments( sb1.with_only("melody_line2"), fabric_staves=( "cco_oboe1", "cco_oboe2", "cco_clarinet1", "cco_clarinet2", ), funcs=( lambda x: x.with_only("phrases", 0).mask("cells", 1).crop( "events", 0, 1).slur_cells(), lambda x: x().with_only("phrases", 0).mask( "events", 0, 1, 2, 3, 4).crop("events", 0, 1).slur_cells(), lambda x: x.with_only("cells", 0, 1, 2).poke("events", 4). e_smear_before(extend_beats=3, rearticulate=True).e_smear_after( extend_beats=4).ops("note_events")(0, "pp", "\\<")( 1, "mp", )(), lambda x: x.with_only("cells", 0, 1, 2).poke("events", 9). e_smear_before(extend_beats=3.5, rearticulate=True).e_smear_after( extend_beats=4).ops("note_events")(0, "pp", "\\<")( 1, "mp", )(), )) s.extend_from(intro_melody) s.fill_rests(beats=8) improv_fl_cl = improv.Improv(sb1, fabric_staves=("ooa_flute", "ooa_clarinet"), improv_times=10, selectable_start_beat=8, ranges=pitch_ranges.MID_RANGES, after_funcs=(lambda x: x, lambda x: x.eps(0, "p")())) s.extend_from(improv_fl_cl) cello_drones = lambda_segment.LambdaSegments( sb1.with_only("bass_drones"), fabric_staves=( "ooa_cello1", "ooa_cello2", ), funcs=( lambda x: x.crop("cells", 2).crop_chords(indices=(1, )).fuse().eps( 0, "arco, distorted")(), lambda x: x.crop("cells", 2).crop_chords(indices=(0, )).fuse().eps( 0, "arco, distorted")(), )) s.extend_from(cello_drones) sax_swells = staggered_swell.StaggeredSwell( sb1, fabric_staves=instrument_groups.get_instruments("sax"), ranges=pitch_ranges.MID_RANGES, selectable_start_beat=8, swell_duration=12, # swell_split_ratios = ( # 1/2, # ), # swell_staggers = ( # (0,1), # (0.5,0.5), # (1,0) # ), ) s.extend_from(sax_swells) bass_melody = lambda_segment.LambdaSegments( sb1.with_only("bass_line"), fabric_staves=("ooa_bass_guitar", "cco_bass", "ooa_bassoon"), funcs=( lambda x: x.crop("cells", 1).crop_chords(indices=( 0, 1, )).transformed(calliope.StandardDurations()), lambda x: x.crop("cells", 1).crop_chords(indices=( 1, 0, )).transformed(calliope.StandardDurations()), lambda x: x.crop("cells", 1).crop_chords(indices=(1, )).mask( "note_events", 2, 3, 8, 12).smear_after(fill=True, gap_beats=1) .slur_cells().eps(1, "p")(), ), ) s.extend_from(bass_melody) # # ======================================================= # counter to violin i counter_violin = lambda_segment.LambdaSegment( sb1.with_only("counter_line"), func=lambda x: x.crop("phrases", 1).fuse().eps(1, "p", "arco (normal)") (2, 7, 9, 12, 14, 16, 20, 25, 27, 30, "(") (3, 8, 10, 13, 15, 17, 21, 26, 28, 31, ")")(), fabric_staves=("cco_violin_i", ), ) s.extend_from(counter_violin) # # ======================================================= # string padding: # TO DO: vary up the ranges pad_durations = (2, 1, 2, 2, 1, 2, 2) # based on 3 + 5 + 4 bookend_beats = ( None, (4, 0), None, ) start_offset = (8, 8, 12) strings_pads = [ lyrical.Intro2Pad( sb1, mask_staves=("cco_bass", "cco_violin_i"), pad_durations=pad_durations, ranges=pitch_ranges.PitchRanges(pitch_ranges.MID_SEQ), selectable_start_beat=start_offset[i] + sum(pad_durations) * i, bookend_beats=bookend_beats[i]) for i in range(3) ] for st in strings_pads[0].staves: st.note_events[0].tag("p", "arco (normal)") s.extend_from(*strings_pads) s.fill_rests(beats=24) # # ======================================================= # more winds swells: # TO DO: vary these up! s.extend_from(lyrical.CcoWindsSwell( sb1, ranges=pitch_ranges.MID_RANGES, selectable_start_beat=6 * 4, ), lyrical.CcoWindsSwell( sb1, ranges=pitch_ranges.MID_RANGES, selectable_start_beat=6 * 4 + 6, ), lyrical.CcoWindsSwell( sb1, ranges=pitch_ranges.MID_RANGES, selectable_start_beat=6 * 4 + 12, ), lyrical.CcoWindsSwell( sb1, ranges=pitch_ranges.MID_RANGES, selectable_start_beat=6 * 4 + 18, ), extend_last_machine=True) # # ======================================================= # TO DO MAYBE: re-add these pulses? # s.extend_from( # lyrical.CcoStringPulses( # pulse_beats=16, # mask_staves=("cco_bass",), # ) # ) # # ======================================================= # TO DO MAYBE: re-add these pulses? # s.extend_from( # lyrical.CcoStringPulses( # pulse_duration=0.5, # pulse_beats=8, # mask_staves=("cco_bass",), # ) # ) # TO DO MAYBE: add more fragments of counter melody? # # ======================================================= s.fill_rests() for staff in s.staves: if segs := staff.segments: main_seg = segs[0] for next_seg in list(segs[1:]): main_seg.extend(next_seg) next_seg.parent.remove(next_seg) main_seg.rehearsal_mark_number = 3 main_seg.auto_respell() main_seg.compress_full_bar_rests = True
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