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
20 changes: 19 additions & 1 deletion blues_solo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

SAMPLE_FILE = os.path.join(SAMPLES_DIR, "bass_D2.wav")
SAMPLE_NOTE = D2 # the sample file plays at this pitch
BACKING_TRACK = os.path.join(SAMPLES_DIR, "backing.wav")
sample(BACKING_TRACK, amp=1)
sleep(2.25) # delay the solo to match up with backing track



def play_note(note, beats=1, bpm=60, amp=1):
Expand Down Expand Up @@ -39,4 +43,18 @@ def stop():
blues_scale = [40, 43, 45, 46, 47, 50, 52, 55, 57, 58, 59, 62, 64, 67, 69, 70, 71, 74, 76]
beats_per_minute = 45 # Let's make a slow blues solo

play_note(blues_scale[0], beats=1, bpm=beats_per_minute)
#play_note(blues_scale[0], beats=1, bpm=beats_per_minute)
curr_note = 0
play_note(blues_scale[curr_note], 1, beats_per_minute)
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)],[(1, 0.25*1.1), (-1, 0.5*0.9),
(2, 0.75*1.1), (1, 0.5*0.9)]]
for _ in range(6):
lick = licks[random.choice([0,1,2])]
for note in lick:
if curr_note +note[0]<0:
curr_note = curr_note+1
elif curr_note + note[0] > len(blues_scale)-1:
curr_note+= curr_note-note[0]
else:
curr_note += note[0]
play_note(blues_scale[curr_note], note[1], beats_per_minute)