diff --git a/blues_solo.py b/blues_solo.py index 45791ad..8f57bd2 100644 --- a/blues_solo.py +++ b/blues_solo.py @@ -28,9 +28,51 @@ def add_note(out, instr, key_num, duration, bpm, volume): """ these are the piano key numbers for a 3 octave blues scale in A See: http://en.wikipedia.org/wiki/Blues_scale """ + +# defins the scale and time blues_scale = [25, 28, 30, 31, 32, 35, 37, 40, 42, 43, 44, 47, 49, 52, 54, 55, 56, 59, 61] beats_per_minute = 45 # Let's make a slow blues solo -add_note(solo, bass, blues_scale[0], 1.0, beats_per_minute, 1.0) +curr_note = 0 # initializes current note +add_note(solo, bass, blues_scale[curr_note], 1.0, beats_per_minute, 1.0) + +# blues +licks = [ [ [1,0.5], [1,0.5], [1, 0.5], [1, 0.5] ], +[ [-1, 0.5], [-1, 0.5], [-1, 0.5], [-1, 0.5] ] ] + +# swing +swing_licks = [ [ [1, 0.5*1.1], [1, 0.5*0.9], [1, 0.5*1.1], [1, 0.5*0.9] ], +[ [-1, 0.5*1.1], [-1, 0.5*0.9], [-1, 0.5*1.1], [-1, 0.5*0.9] ], +[ [2, 0.5*2.1], [-1, 0.5*0.9], [2, 0.5*1.9], [1, 0.5*1.1] ] ] + +for i in range(4): + lick = choice(swing_licks) + for note in lick: + curr_note += note[0] + + # checks current note and defines volume + if curr_note < 0: + curr_note = 1; + volume = 2 + elif curr_note > len(blues_scale) - 1: + curr_note = 1 + volume = 4 + elif curr_note != len(blues_scale) - 3: + volume = 3 + else: + volume = 2 + + # uses function to add the note + add_note(solo, bass, blues_scale[curr_note], note[1], beats_per_minute, volume) + +# adds background music +backing_track = AudioStream(sampling_rate, 1) +Wavefile.read('backing.wav', backing_track) +m = Mixer() +solo *= 0.4 # adjust relative volumes to taste +backing_track *= 2.0 +m.add(2.25, 0, solo) # delay the solo to match up with backing track +m.add(0, 0, backing_track) + -solo >> "blues_solo.wav" \ No newline at end of file +m.getStream(500.0) >> "slow_blues.wav"