class Line3(GenC, machines.RhythmsBroken, gen_b.Line3): clef = None metrical_durations = ID({ 7:((1,4),)*4, 8:((1,4),)*4, 9:((1,2),)*2, 10:((1,4),)*4, 12:((1,4),)*2 + ((1,2),), }, default=((1,1),), limit=24) # rhythm_initial_silence = 28 rhythm_initial_silence = 56 breaks = ID1({ 7: 2, 10: -0.5, 11: 2, 13: 1, }, cyclic=False) pitch_respell = "sharps" rhythm_times = 1 # TO DO: do we want to repeat?? (would need to adjust or truncate the end) pitch_displacement = machines.FifthDisplacement( up = (2,3,4,7,9,10, 17, 27), down = ( 5,6, 11) ) respell="sharps"
class Line4(Line3): clef = None metrical_durations = ID({ # TO DO... mobve this to arrangement? 8:((1,4),)*4, 9:((1,4),)*4, 10:((1,2),(1,4),(1,4),), 11:((1,4),)*4, 12:((1,2),(1,4),(1,4),), 13:((1,2),(1,4),(1,4),), 14:((1,4),)*4, 15:((1,4),)*4, }, default=((1,1),), limit=24) # metrical_durations = ((1,1),)*8 + ((1,4),)*8 + ((1,2),(1,4),(1,4),) + ((1,4),)*4 + ((1,1),)*13 rhythm_initial_silence = 30 rhythm_times=1 # TO DO: ditto as Line3 - do we want to repeat?? (would need to adjust or truncate the end) pitch_displacement = machines.FifthDisplacement( up = (2,5,7,9), down = ( 6,8,) ) rhythm_multipliers = Line3.rhythm_multipliers.copy() rhythm_multipliers[8] = 0.5 def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__.__name__ == "Line4": self.tag_events("darkred", every_child=True)
class Line1(HarmonyLineGenD, gen_c.Line1): rhythm_initial_silence = 5 * (3 * 3/2) # TO DO... should come up with some more elegant way to do this copy/multiplication breaks = gen_c.Line1.breaks.copy() for i in breaks.keylist(): breaks[i] = breaks[i] * 1.5 pitch_displacement = gen_c.Line1.pitch_displacement +\ machines.FifthDisplacement( up =(35, 40), down=(30,31), ) # +\ # machines.FifthDisplacement( # up =( 14,16,20,27,30,35), # down=(13, 18,), # ) # pitch_displacement[31] |= set((-12,)) # TEMP USE ... see octave down for ease-of-viewing only # print(pitch_displacement) respell = None def update_data(self, **kwargs): super().update_data(**kwargs) self.respell_events("sharps",0,13) self.respell_events("flats",13) if self.__class__ is Line1: self.events[13].tag("8va") self.events[30].tag("8va!")
class Line7(GenF, gen_e.Line6): # show_data_type = machines.SegmentData rhythm_initial_silence = 52 breaks = ID() breaks.extend( [-3]*18 ) breaks[10] = -3.5 breaks[15] = -1 rhythm_multipliers = machines.RhythmsMultiplied.make_multipliers({ 5:0.5, 9:0.5, 14:0.5, 18:0.5, },default=0.25) rhythm_times = 2 pitch_displacement = gen_e.Line6.pitch_displacement.copy() pitch_displacement.flat(38) pitch_displacement = pitch_displacement + \ machines.FifthDisplacement( up = ( 11,12,17, 32, 35, 37,38,41, 48), down=(0,1,2,3, 18, 36, 42,43), ) + \ machines.OctaveDisplacement( up=(1,2,3, 23, 36, ), down=(10, 19, 38), ) # print(pitch_displacement) def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__.__name__ == "Line7": self.tag_events("magenta", every_child=True)
class Line3(GenF, gen_e.Line4): # rhythm_reverse = list(gen_e.Line4.rhythm_reverse) # rhythm_reverse.remove(7) rhythm_initial_silence=23 pitch_reverse = gen_e.Line4.pitch_reverse + (19,25) # show_data_type=machines.EventData pitch_displacement = machines.FifthDisplacement( up=( 6,7, 19,20, 22, 24, 26, 30, 58,76), down=(2,4, 8,9,12, 16, 18, 21, ) ) +\ machines.OctaveDisplacement( up=(1,3,4,9, 12, 16, 21), down=(5,7, 11, 19, 22, 26) ) breaks = gen_e.Line4.breaks + ID({ 1:5, 3:1, 10:-4, 11:0, 13:-1, 19:-2, 25:-1, 26:1, }) rhythm_times = 3 # NOTE... 3rd time cuts off... maybe that's Ok rhythm_multipliers = gen_e.Line4.rhythm_multipliers rhythm_multipliers[18]=1 clef="treble"
class Line4(Line3): clef = "bass" pitch_displacement = machines.FifthDisplacement(up=(25, ), down=(26, )) def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__.__name__ == "Line4": self.tag_events("darkred", every_child=True)
class Line2(Line1): rhythm_initial_silence = 30 pitch_displacement = machines.FifthDisplacement(up=(2, 15, 17, 22, 25), down=(3, 16, 21)) def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__.__name__ == "Line2": self.tag_events("darkgreen", every_child=True)
class Line2(GenB, machines.RhythmsMultiplied, gen_a.Line2): clef = "bass" rhythm_initial_silence = 24 rhythm_multipliers = machines.RhythmsMultiplied.make_multipliers() rhythm_multipliers.extend((1, ) + (1, 0.5) * 3 + (3, 3)) pitch_displacement = machines.FifthDisplacement(up=(4, ), down=(3, 11, 14)) def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__ is Line2: self.events[1].tag("\clef bass")
class Line1(GenE, gen_d.Line1): pitch_displacement = machines.FifthDisplacement() pitch_displacement.cycle_me(2, cycle=(1, 0, 0, -1, -1, 1), times=5) pitch_displacement.cycle_me(31, cycle=(0, -1, -1, 0, 1, 1), times=24) rhythm_initial_silence = 24 rhythm_times = 4 def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__ is Line1: self.events[11].tag("\clef bass")
class Line2(GenC, machines.RhythmsBroken, gen_b.Line2): clef = None rhythm_initial_silence = 22 breaks = ID1({ 3: -4, }) pitch_displacement = machines.FifthDisplacement( up = (2,4,24,25,27), down = ( 9,) ) respell="sharps"
class Line3(GenE, machines.RhythmsReverse, machines.PitchesReverse, gen_d.Line3): pitch_displacement = machines.FifthDisplacement(up=(1, )) pitch_displacement.cycle_me(26, cycle=(-1, -1, 1, 1), times=2) pitch_displacement.cycle_me(33, cycle=(-1, -1, 0, 1, 0, 1), times=4) pitch_reverse = (4, 6, 13, 15) # TO DO... use better ID methods to populate these... rhythm_reverse = (1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17) rhythm_initial_silence = 23 rhythm_times = 4
class Line6(GenG, gen_f.Line6): rhythm_pulses = ID({}, default=0.5) pitch_displacement = gen_f.Line6.pitch_displacement.copy() pitch_displacement.flat(2, 3) pitch_displacement += machines.FifthDisplacement( up=(17, 22, 28, 46), down=(0, 1, 2, 3), ) + machines.OctaveDisplacement( up=(0, 2, 22), down=(5, 19, 28, 46), )
class Line5(Line4): pitch_displacement = machines.FifthDisplacement(up=(29, 35, 38, 41, 42, 47, 52, 53), down=(28, 33, 34, 37, 40, 44, 46, 48, 50)) def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__ is "Line5": self.events[31].tag("\clef bass") if self.__class__.__name__ == "Line5": self.tag_events("red", every_child=True)
class Line6(GenF, gen_e.Line6): rhythm_initial_silence = 36 # show_data_type = machines.SegmentData breaks = gen_e.Line6.breaks breaks[6] = 0.5 breaks[19] = -4 pitch_displacement = gen_e.Line6.pitch_displacement +\ machines.FifthDisplacement( up = ( 28,29,35,38), down=(1,3,7,12), ) + \ machines.OctaveDisplacement( up=(1,3,9,), down=( 29,47,) )
class Line4(GenG, gen_f.Line4): rhythm_pulses = ID({}, default=0.5) pitch_displacement = gen_f.Line4.pitch_displacement.copy() pitch_displacement += machines.FifthDisplacement( up=(14, 17, 18, 22), down=(0, 1, 2, 3, 4), ) + machines.OctaveDisplacement( up=(2, 3, 4), down=(1, 11, 25), ) print(pitch_displacement) def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__ is Line4: self.events[1].tag("\clef bass")
class Line2(GenE, gen_d.Line2): # TO DO... revisit this now that harmonies adjusted in gen_d pitch_displacement = machines.FifthDisplacement() # pitch_displacement = gen_d.Line2.pitch_displacement.copy() for i, f in gen_d.Line2.pitch_displacement.non_default_items()[::2]: # if i%2 != 0: pitch_displacement[i] = f pitch_displacement.flat(9, 38) pitch_displacement.up(26, 27, 28) # pitch_displacement.up(28,29,31) # pitch_displacement.down(21) # pitch_displacement.flat(3,9,23,27,28) # # pitch_displacement.up(22) # pitch_displacement.cycle_me(24, cycle=(1,1,0,-1,-1,0), times=12) rhythm_times = 5 rhythm_initial_silence = 27
class Line1(GenB, machines.RhythmsMultiplied, gen_a.Line1): clef = "bass" rhythm_initial_silence = 29 rhythm_multipliers = machines.RhythmsMultiplied.make_multipliers({ 3: 0.5, 7: 0.5, 8: 3, 9: 2 }) pitch_displacement = gen_a.Line1.pitch_displacement +\ machines.FifthDisplacement(down=(2,14), up=(27,)) pitch_displacement.flat(8, 24) def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__ is Line1: self.events[1].tag("\clef bass")
class Line1(GenC, machines.RhythmsBroken, gen_b.Line1): clef = None rhythm_initial_silence = 24 breaks = ID1({ 2: -4, 3: -2, 4: 1, 5: 2, 6: -2, 7: -4, 11: -4, 12: -8 }) pitch_displacement = machines.FifthDisplacement() pitch_displacement.cycle_me(2, cycle=(1,1,-1,-1,-1,1), times=16) pitch_displacement.flat(11) pitch_displacement.up(29) respell = "sharps" rhythm_times = 2
class Line5(GenG, gen_f.Line5): # rhythm_pulses = ID({}, default=0.5) rhythm_initial_silence = 24 pitch_displacement = gen_f.Line5.pitch_displacement.copy() pitch_displacement.flat(33) pitch_displacement += machines.FifthDisplacement( up=(8, 10, 11, 34, 40), down=(0, 2, 3, 6), ) + machines.OctaveDisplacement( up=(1, 3, 4, 12), down=(10, 12, 38, 41), ) respell = None # print(pitch_displacement) def update_data(self, **kwargs): super().update_data(**kwargs) self.respell_events("flats", 0, 29) self.respell_events("sharps", 29)
class Line5(GenF, gen_e.Line5): rhythm_initial_silence = 30 rhythm_multipliers = machines.RhythmsMultiplied.make_multipliers(default=1) for i,r in gen_e.Line5.rhythm_multipliers.non_default_items(): rhythm_multipliers[i] = r * 2 breaks = gen_e.Line5.breaks.copy() breaks[1] = -2 pitch_displacement = gen_e.Line5.pitch_displacement +\ machines.FifthDisplacement( up = ( 3, 11,13,14,15,32,33,34,37,44), down=(2,5,6,7,9,10, 42), ) + \ machines.OctaveDisplacement( up=(7,9), down=(13,14, 32, 35), ) def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__ is Line5: self.events[1].tag("\clef bass")
class Line4(GenD, gen_c.Line4): metrical_durations = ID(default=((3,8),(3,8),(3,8),), limit=24) rhythm_times = 3 rhythm_initial_silence = ((8 * 3) + 2) * 3/2 # show_data_attr="my_index" # show_data_type=machines.SegmentData pitch_displacement = gen_c.Line4.pitch_displacement +\ machines.FifthDisplacement( up= (8, 19, 24,25,27, 40, 45,47 ), down=( 20,22, 36,37,38, 41, 48, 53), ) pitch_displacement.cycle_me(55, cycle=(-1,0,1,-1,1,0), times=3) breaks = ID1({ 10: -12.5, 19: -3.5, # 11: 2, # 13: 1, }, cyclic=False) def update_data(self, **kwargs): super().update_data(**kwargs)
class Line3(GenB, machines.RhythmsMultiplied, gen_a.Line1): clef = "bass" # TO DO, use fill here to make this cleaner metrical_durations = ID( { 0: ((3, 4), ), 1: ((3, 4), ), 2: ((3, 4), ), 3: ((3, 4), ), 4: ((3, 4), ), }, default=((1, 4), ) * 3, limit=24) rhythm_initial_silence = 36 def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__.__name__ == "Line3": self.tag_events("darkyellow", every_child=True) if self.__class__ is Line3: self.events[1].tag("\clef bass") # TO DO... this is ugly: rhythm_multipliers = machines.RhythmsMultiplied.make_multipliers( cyclic=True, cyclic_start=1) rhythm_multipliers.extend(( 1, 0.5, ) + ( 0.25, 0.5, ) * 3 + (0.25, 1)) # print(rhythm_multipliers) # rhythm_multipliers += { # 10: 0.5 # } pitch_displacement = machines.FifthDisplacement( up=(22, 52, 53, 54), down=(1, 19, 26, 38, 46), ) rhythm_times = 2
class Line7(GenG, gen_f.Line7): # rhythm_multipliers = ID({}, default=1) rhythm_multipliers = gen_f.Line7.rhythm_multipliers rhythm_multipliers.default = 0.5 # my_short_notes = (2,3,5,6,8,9,11,12,17,18,20,21,23,24,29,30,) rhythm_pulses = ID({}, default=0.5) rhythm_times = 4 pitch_displacement = gen_f.Line7.pitch_displacement pitch_displacement.flat(2) pitch_displacement += machines.FifthDisplacement( up=(31, 35, 48, 65, 66, 70, 76), down=( 2, 12, ), ) + machines.OctaveDisplacement( up=( 6, 12, ), down=(7, 34, 65, 71), ) breaks = gen_f.Line7.breaks breaks[2] = -4 breaks[3] = -4 breaks[4] = -5.5 breaks[13] = -3 breaks[15] = -5.5 breaks[21] = -2.5 breaks[22] = -1 # breaks[23] = -1 # TO DO... WHY DOESN'T THIS WORK????!!!! # print(pitch_displacement) # breaks = gen_f.Line7.breaks # breaks[1] = -2 # breaks[2] = 0 respell = None def update_data(self, **kwargs): super().update_data(**kwargs) self.respell_events("flats", 0, 32) self.respell_events("sharps", 31)
class Line2(GenF, gen_e.Line2): clef = "bass" # rhythm_multipliers = machines.RhythmsMultiplied.make_multipliers(default=1, limit=40) pitch_displacement_fifths = machines.FifthDisplacement(down=(0,)) pitch_displacement_fifths.cycle_me(1, cycle=(1,-1,-1,1), times=36) pitch_displacement_fifths.down(12) pitch_displacement_fifths.up(34) pitch_displacement_fifths.flat(45,46,54,56,71,80,82,92,95,104,106,107,116,119,135) pitch_displacement_octaves = machines.OctaveDisplacement() pitch_displacement_octaves.cycle_me(1, cycle=(-1,1,0,-1,1,0), times=28) pitch_displacement_octaves.flat(13) pitch_displacement_octaves.flat(47) pitch_displacement = pitch_displacement_fifths + pitch_displacement_octaves # print(pitch_displacement) breaks = gen_e.Line1.breaks.copy() rhythm_initial_silence = 28 for i in breaks.keylist(): breaks[i] = breaks[i] * 2 / 1.5 rhythm_multipliers = gen_e.Line2.rhythm_multipliers.copy() rhythm_multipliers.default = 1 for i in rhythm_multipliers.keylist(): print(i) rhythm_multipliers[i] = rhythm_multipliers[i] / 1.5 # pitch_displacement = machines.FifthDisplacement() # for i,f in gen_e.Line2.pitch_displacement.non_default_items()[::2]: # pitch_displacement[i]=f # for i,p in Line3.pitch_displacement.non_default_items(): # for j in range(2): # pitch_displacement[i + j*27] |= p def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__ is Line2: self.events[1].tag("\clef bass") self.respell_events("flats", 1, 33) self.respell_events("sharps", 34)
class Line8(Line5): rhythm_initial_silence = 27 rhythm_pulses = ID({}, default=0.5) rhythm_multipliers = ID({}, default=1) pitch_displacement = machines.FifthDisplacement( up=(8, 10, 13, 25, 37, 38, 44, 45, 55, 64), down=(0, 1, 2, 3, 4, 42, 47), ) pitch_displacement += machines.OctaveDisplacement(up=(2, 15, 27, 30, 42), down=(13, 25, 28, 31, 38, 41, 55)) rhythm_times = 4 respell = None def update_data(self, **kwargs): super().update_data(**kwargs) self.respell_events("flats", 0, 40) self.respell_events("sharps", 40) if self.__class__ is Line8: self.events[1].tag("\clef bass") if self.__class__.__name__ == "Line8": self.tag_events("darkblue", every_child=True)
class Line4(GenF, gen_e.Line3): # show_data_type=machines.SegmentData rhythm_initial_silence = 28 pitch_displacement = gen_e.Line3.pitch_displacement +\ machines.FifthDisplacement( up= ( 16,17, 25, 26, 27, 31, 79), down= (1,4,7, 12, 14, 15, )) +\ machines.OctaveDisplacement( up= ( 4, 7, 19, ), down=(1, 17, 28, 56)) pitch_reverse = gen_e.Line3.pitch_reverse + (3,) breaks = gen_e.Line3.breaks + { 2:-2, 4:-5, 10:4, } def update_data(self, **kwargs): super().update_data(**kwargs) if self.__class__ is Line4: self.events[1].tag("\clef bass") if self.__class__.__name__ == "Line4": self.tag_events("darkred", every_child=True)
class Line2(HarmonyLineGenD, gen_c.Line2): rhythm_initial_silence = 6 * (3 * 3/2) pitch_displacement = gen_c.Line3.pitch_displacement +\ machines.FifthDisplacement( down=(21,24,27,28,29) ) pitch_displacement.cycle_me(30, cycle=(-1, -1, 0,-1,-1, 1, 1, 1, 1), times=9) pitch_displacement.flat(68) pitch_displacement.down(72) pitch_displacement.flat(76) respell = None # TO DO... ditto, should come up with some more elegant way to do this copy/multiplication breaks = gen_c.Line2.breaks.copy() for i in breaks.keylist(): breaks[i] = breaks[i] * 1.5 # print(pitch_displacement) def update_data(self, **kwargs): super().update_data(**kwargs) self.respell_events("sharps",0,11) self.respell_events("flats",11) if self.__class__.__name__ == "Line2": # this helps restrict tags to short score only self.events[11].tag("\clef bass")
class Line3(GenD, gen_c.Line3): metrical_durations = ID(default=((3,8),(3,8),(3,8),), limit=24) rhythm_multipliers = machines.RhythmsMultiplied.make_multipliers(cyclic_start=1, cyclic=False) rhythm_multipliers.extend( (1,) + (0.5,1,0.5,1,1,0.5,0.5,1,1) + (1,1,1,1,1,0.5,1,1,3) ) rhythm_times = 1 pitch_displacement = gen_c.Line3.pitch_displacement +\ machines.FifthDisplacement( up = (1,8), down=( 9,17,) ) pitch_displacement.cycle_me(18, cycle=(-1,-1,-1,1,1,1), times=6) rhythm_initial_silence = 49.5 breaks = ID({ 2: -3, 4: -3, 6: 3, 8: 1, 10: 6, 11: 1, 15: 1, 17: 1 })
class Line5(GenD, gen_c.Line4): metrical_durations = ID(default=((9,8),), limit=24) metrical_durations.fillme(range(12,24), ((3,8),)*3) rhythm_initial_silence = (11*3 + 2) * 3/2 # TO DO... this could be made more readable... multiplier_phrase = (0.5,)*2 + (0.25,)*2 + (0.5,) + (0.25,)*4 + (0.5,) + (0.25,)*3 + (0.5,) + (0.25,)*4 rhythm_multipliers = machines.RhythmsMultiplied.make_multipliers() rhythm_multipliers.extend( (1,) + (0.5,)*2 + (0.25,)*2 + multiplier_phrase*2 + (0.5,)*2 ) breaks = ID() rhythm_times = 5 pitch_displacement = machines.FifthDisplacement( up = (1,2,3,4,5,7) ) # pitch_displacement[0] = (-24,) # TEMP USE ... see 2 octaves down for ease-of-viewing only respell = "flats" def update_data(self, **kwargs): super().update_data(**kwargs) self.events[7].tag("8va") self.events[126].tag("8va!") if self.__class__ is Line5: self.tag_events("red", every_child=True)
# - show measure numbers on multimeasure rests # - limit multimeasure rest length to 8 bars? (see below... could create list of lists to determine measure count) # - - - - - maybe better... limit to 8 only if greater than 9? # - - - - - also, would be ideal to be able to specify break points... # - easily turn colors on and off # - add events from multiple lines into a single harmonic event # - beaming tags # - remember slur_me ! # should be able to easily add instruction AFTER note import abjad from calliope import bubbles from copy import copy from copper import machines f = machines.FifthDisplacement(up=(1, 2, 3), down=(5, 6, 7)) print(f.non_default_items()[::2]) # r = abjad.scoretools.make_multimeasure_rests([ (6,8),(3,8), (6,8),(3,8), (6,8),(3,8), ]) # from copper.machines import Fragments # a = machines.IndexedData(default=78) # b = machines.IndexedData({ # 14: 2, # }) # c = a + b # print(a) # print(b) # print(c)