Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions blues_solo.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,44 @@ def add_note(out, instr, key_num, duration, bpm, volume):
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)

solo >> "blues_solo.wav"
roots = [0, 6, 12]
curr_note = choice(roots)
add_note(solo, bass, blues_scale[curr_note], 1.0, beats_per_minute, 1.0)

licks = [[[1, 0.5], [1, 0.5], [1, 0.5], [1, 0.5]],
[[-1, 0.5], [-1, 0.5], [-1, 1]],
[[2, 0.5], [2, 0.5], [2, 0.75], [-1, 0.25]],
[[2, 0.5*1.1], [-1, 0.5*0.9], [2, 0.5*1.1], [-1, 0.5*0.9]],
[[-2, 1], [0,1]],
[[3, 2]],
[[0, 0.3], [0, 0.3], [0, 0.3], [2, 1.1]]]

for i in range(16):
lick = choice(licks)
for note in lick:
if curr_note <= 0:
curr_note = 1
elif curr_note >= len(blues_scale) - 1:
curr_note = choice(range(len(blues_scale) - 1))
else:
curr_note += note[0]
if i > 10 and i < 14:
add_note(solo, bass, blues_scale[curr_note], note[1], beats_per_minute, 1.0 + float(i)/4)
else:
add_note(solo, bass, blues_scale[curr_note], note[1], beats_per_minute, 1.0)

# solo >> "blues_solo.wav"

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)

m.getStream(500.0) >> "slow_blues.wav"