def play(): # playing all the power chords in a chromatic scale. output = Performance(bpm=120, stop_seconds=10) # play the two scales for 7 beats each, and then keep using those scales scale1 = scale("c4 chromatic") scale_choices = dict(scale=scale1, beats=12) source = ScaleSource(scales=scale_choices) follower = ScaleFollower(lengths=12) chordify = Chordify(types="power", channel=1) source.chain([follower, chordify, output]) conductor = Conductor(signal=[source], performance=output) conductor.start()
def play(): # here we aren't introducing any new concepts, but we're arranging some # concepts a little differently. This is somewhat of a review, as we're going # to start exploring some more (hopefully) musical demos in our examples now. # This one sounds just a bit Perrey and Kingsley with the right VST. output = Performance(bpm=60, stop_seconds=10) # let's play in the A major scale scale_choices = Endlessly([dict(scale=scale("a4 major"))]) source = ScaleSource(scales=scale_choices) # we're going to alternate between the 1st, 4th, and 5th notes # of the scale, but we didn't just jump to chords because of what # we are about to do with the arp. roman = Roman(symbols=Endlessly("1 4 5".split()), channel=1) # and now for a clever use of the arp, to machine gun 4 repititions of # each chord, with rests in between. Subdivide alone couldn't do this. # Also notice this is running with NO tranpositions. arp = Arp( # no transpositions semitones=Endlessly([0, 0, 0, 0, 0, 0, 0, 0]), # every beat gets sliced up 8 times, no exceptions splits=Endlessly([8]), # try uncommenting this next line: #octaves=Endlessly([0,0,1,0,2,0,3,0]), # play every other note on the arp # TODO: IDEA: seems like we should also allow arp velocity! rests=Endlessly([0, 1, 0, 1, 0, 1, 0, 1])) # now the output here is just machine gunned notes. Turn it into major chords. chordify = Chordify(types=Endlessly(['major'])) source.chain([roman, arp, chordify, output]) conductor = Conductor(signal=[source], performance=output) conductor.start()
def play(): # example 05 was "playing all the power chords in a chromatic scale". # let's modify the example very slightly using Subdivide. # normally the conductor sends down quarter notes. Let's alternate # playing quarter notes and sixteenth notes. output = Performance(bpm=120, stop_seconds=10) # play the two scales for 7 beats each, and then keep using those scales source = ScaleSource(scales=scale("c4 chromatic")) follower = ScaleFollower(lengths=12) # pay attention to this part - nothing else has changed subdivide = Subdivide(splits=Endlessly([1, 4])) chordify = Chordify(types="power", channel=1) source.chain([follower, subdivide, chordify, output]) conductor = Conductor(signal=[source], performance=output) conductor.start()
def test_simple_band(self): output = Performance(bpm=120, stop_seconds=10) scale1 = scale("c6 major") scale2 = scale("c6 minor") source = ScaleSource( scales=[dict(scale=scale1, beats=7), dict(scale=scale2, beats=7)]) subdivide = Subdivide(splits=[4]) roman = Roman(symbols="1 2 3 4 I IV V iii".split(), channel=1) follower = ScaleFollower(lengths=[7]) chordify = Chordify(types=['power']) shift = Transpose(octaves=[-3], channel=2) source.chain([subdivide, roman, output]) source.chain([follower, chordify, shift, output]) conductor = Conductor(signal=[source], performance=output) conductor.start()
def play(): # example 05 was "playing all the power chords in a chromatic scale". # example 06 used subdivide to chop up alternating measures with faster notes # now lets alternately transpose every 2nd measure up an octave # and every 3rd measure down an octave output = Performance(bpm=120, stop_seconds=10) source = ScaleSource(scales=scale("c4 chromatic")) follower = ScaleFollower(lengths=Endlessly([12])) subdivide = Subdivide(splits=Endlessly([1,4])) # pay attention to this part - nothing else has changed transpose = Transpose(octaves=Endlessly([0,1,-1])) chordify = Chordify(types="power", channel=1) source.chain([follower, subdivide, transpose, chordify, output]) conductor = Conductor(signal=[source], performance=output) conductor.start()
def play(): # this is sort of a variation of example 08. Except now, rather than # playing two different patterns that might clash, we're selecting chord # patterns for instrument 2 to harmonize with what instrument 1 is playing. output = Performance(bpm=120, stop_seconds=10) # both instruments will use the same scale at the same time, but there is a scale # change as we cycle between scales every 24 beats scale1 = scale("c5 major_pentatonic") scale2 = scale("e5 mixolydian") scale_choices = [ dict(scale=scale1, beats=24), dict(scale=scale2, beats=24) ] source = ScaleSource(scales=Endlessly(scale_choices)) # the first instrument plays a series of notes roman1 = Roman(symbols=Endlessly("1 2 4 1 2 3 1 2 4 3 3".split()), channel=1) source.chain([roman1, output]) # the second instrument transposes that note down two octaves and plays a power # chord. We could pass in an array of chords to vary the chord type, but this is # probably going to sound less prone to clashing. chordify = Chordify(types=Endlessly(["power"]), channel=2) transpose = Transpose(octaves=Endlessly([-2])) source.chain([roman1, chordify, transpose, output]) # note that roman 1 is part of each chain, but the channel number is overridden # in the second set. This can be done because the event objects are copied as they # are passed between each layer. Technically the channel can be overriden at any # time. Ideas for future chaos, perhaps? conductor = Conductor(signal=[source], performance=output) conductor.start()
def play(): # Permit, introduced in the example 18_randomness2.py allows us to # silence an entire chain when certain conditions are met. # However, sometimes, we may want to decide to apply an affect only # when something is true. Because this could be useful ANYWHERE # the same type of "when" logic can actually be attached to ANYTHING. # here is a probabilistic way to use random, that combines the concepts. output = Performance(bpm=120, stop_seconds=15) source = ScaleSource(scales=scale("Ab blues")) melody = Roman(symbols=Endlessly("1 2 3 4 5 6 7".split()), channel=1) chordify = Chordify(types=Endlessly(['major', 'minor']), when=Randomly([0, 0.45], mode='probability')) transpose = Transpose(octaves=Endlessly([2, -2]), when=Randomly([0, 0, 0.75], mode='probability')) # the result is every other note has a 40% chance of becoming a chord, which is always alternating # major and minor when it happens # every THIRD note has a 75 percent chance of being transposed, which will be alternating +2/-2 octaves # when it happens # so now, we have easily inserted CONDITIONAL effects. The use of when=Randomly wasn't required. # we could also have used Endlessly or Repeatedly. Though keep in mind if using Repeatedly, when # the event chain is exhausted, that particular part of the performance will stop. And when everything stops, # the performance is done. Because this is likely being applied to an effect chain, Repeatedly probably # doesn't make the most sense with "when". But Endlessly? Sure! source.chain([melody, chordify, transpose, output]) conductor = Conductor(signal=[source], performance=output) conductor.start()
def play(): # We are building a house of fire, baby. song = SongFactory(name='Foo', author='Your Name') song.set_defaults(bpm=120, scene_bar_count=8) song.set_instruments( strings=Instrument(channel=1), lead=Instrument(channel=2), ) song.set_patterns( typ='basic', patterns=dict( some_jam_pt1= "4 6 1 6 | 4 4 4 4 | 6 6 4 1 | 1 4 6 4 | 6 4 4 4 | 4 6 4 6", some_jam_pt2= "1 2 3 4 | 3 2 5 1 | 1 1 7 6 | 5 4 3 2 | 1 2 3 4 | 5 6 7 1", )) song.set_patterns( typ='random', mode='probability', patterns=dict( # chordify_chance_pt = [ 0, 0.5 ] )) song.set_patterns(typ='random', mode='exhaust', patterns=dict(serialism="1 2 3 4 5 6 7 8 9 10 11 12")) song.set_patterns( typ='random', mode='choice', patterns=dict( # random_pt1 = "1 2 3 4 5 6 7", # implies we want a new kind of generator below... # velocity_pt1 = [ 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110 ] )) song.set_patterns( typ='random', mode='probability', patterns=dict( # chordify_chance_pt1 = [ 0, 0.5, 0.25, 0.125 ] )) song.set_patterns( typ='endless', patterns=dict( occasional_holes=[1, 0, 1, 1, 0, 0], chord_sequence=['major', 'minor', 'power'], subdivide_arp=[3], subdivide_lots=[2], transpose_pt1=[2, 0, -2], # duration_pt1 = [ 0.25, 0.25, 0.125, 0.125 ], # chordify_pt1 = [ "major", "major", "minor", "major", "pow", "aug"], basic_chords="I IV V I", boring_part="1", transpose_arp=[0, 4, 5], down_two_up_two=[-2, 2])) # --- FX --- song.set_fx_buses( chordify_lead=FxBus([Chordify(types=song.pattern('chord_sequence'))]), arpeggiate_lead=FxBus([ Arp(semitones=song.pattern('transpose_arp'), splits=song.pattern('subdivide_arp'), octaves=song.pattern('transpose_pt1'), mode='locked') ]), some_silence_and_vamp_but_transpose_down=FxBus( [Transpose(octaves=song.pattern('down_two_up_two'))]), subdivide=FxBus([ # FIXME: Permit seems to not work. Figure out why. Permit(when=song.pattern('occasional_holes')), Subdivide(splits=song.pattern('subdivide_lots')), ])) song.set_scenes( # BOOKMARK: FIXME: bar count is not yet implemented as of time of writing, need a camp.band.members.stop or something to implement. Easy though. overture=Scene( scale="C4 chromatic", bar_count=12, # pre_fx = dict(strings='random_velocity_and_duration'), post_fx=dict(strings='chordify_lead'), patterns=dict(strings='serialism')), llama_theme=Scene( scale="C5 minor", bar_count=12, # pre_fx = dict(lead='subdivide'), # post_fx = dict(strings = 'arpeggiate_strings', lead = 'transpose_lead'), post_fx=dict(strings='arpeggiate_lead', lead='some_silence_and_vamp_but_transpose_down'), patterns=dict(strings='boring_part', lead=[ 'some_jam_pt1', 'some_jam_pt2', 'some_jam_pt1', 'some_jam_pt2' ]))) # -- GO! -- # scene_names = ['overture', 'llama_theme', 'bridge', 'chorus', 'verse', 'chorus', 'verse', 'ending'] # scene_names = ['overture', 'llama_theme' ] scene_names = ['llama_theme'] song.play(scene_names) print(song.to_json())