diff --git a/blues_solo.py b/blues_solo.py index 45791ad..2d08fa6 100644 --- a/blues_solo.py +++ b/blues_solo.py @@ -2,7 +2,8 @@ from Nsound import * import numpy as np -from random import choice +import random + def add_note(out, instr, key_num, duration, bpm, volume): """ Adds a note from the given instrument to the specified stream @@ -30,7 +31,44 @@ def add_note(out, instr, key_num, duration, bpm, volume): See: http://en.wikipedia.org/wiki/Blues_scale """ 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 +duration = [.5, .6, .7 ,.8, .9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5] #added a varying duration on each note +volume = [.7, .8, .9, 1.0, 1.1, 1.2, 1.3] #added a varying volume + +curr_note = 6 #changed starting position +add_note(solo, bass, blues_scale[curr_note], 1.0, beats_per_minute, 1.0) + + +#added a whole of licks, all at random durations +licks = [[ [-1,0.5*random.choice(duration)], [2,0.5*random.choice(duration)], [-1, 0.5*random.choice(duration)], [2, 0.5*random.choice(duration)] ], + [ [1,0.5*random.choice(duration)], [-2,0.5*random.choice(duration)], [-2, 0.5*random.choice(duration)], [1, 0.5*random.choice(duration)] ], + [ [2,0.5*random.choice(duration)], [2,0.5*random.choice(duration)], [-3, 0.5*random.choice(duration)], [2, 0.5*random.choice(duration)] ], + [ [4,0.5*random.choice(duration)], [-1,0.5*random.choice(duration)], [2, 0.5*random.choice(duration)], [-5, 0.5*random.choice(duration)]], + [ [-2,0.5*random.choice(duration)], [-3,0.5*random.choice(duration)], [6, 0.5*random.choice(duration)], [-3, 0.5*random.choice(duration)] ], + [ [2,0.5*random.choice(duration)], [2,0.5*random.choice(duration)], [2, 0.5*random.choice(duration)], [2, 0.5*random.choice(duration)] ], + [ [4,0.5*random.choice(duration)], [1,0.5*random.choice(duration)], [-3, 0.5*random.choice(duration)], [-2, 0.5*random.choice(duration)] ], + [ [0,0.5*random.choice(duration)], [1,0.5*random.choice(duration)], [2, 0.5*random.choice(duration)], [0, 0.5*random.choice(duration)] ], + [ [3,0.5*random.choice(duration)], [2,0.5*random.choice(duration)], [-1, 0.5*random.choice(duration)], [-1, 0.5*random.choice(duration)] ], + [ [-3,0.5*random.choice(duration)], [4,0.5*random.choice(duration)], [0, 0.5*random.choice(duration)], [-4, 0.5*random.choice(duration)] ]] + +for i in range(95): + lick = random.choice(licks) + for note in lick: + curr_note += note[0] + if curr_note > len(blues_scale)-1 or curr_note < 0: #checks for out of bounds cases + curr_note = random.choice([0,6,12,18]) #note will now automatically swtich a random root note if it passes a boundary + add_note(solo, bass, blues_scale[curr_note], note[1], beats_per_minute, random.choice(volume)) + + +backing_track = AudioStream(sampling_rate, 1) +Wavefile.read('backing.wav', backing_track) + +m = Mixer() + +solo *= .6 # volumes were adjusted for slightly balancing of songs (although tbh hard to tell when my song is so random lol) +backing_track *= 1.6 -add_note(solo, bass, blues_scale[0], 1.0, beats_per_minute, 1.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 +#changed the length of the track +m.getStream(265.0) >> "slow_blues.wav" \ No newline at end of file diff --git a/blues_solo.wav b/blues_solo.wav new file mode 100644 index 0000000..d49a5d6 Binary files /dev/null and b/blues_solo.wav differ diff --git a/slow_blues.wav b/slow_blues.wav new file mode 100644 index 0000000..9a705d8 Binary files /dev/null and b/slow_blues.wav differ