Group 08

Download .ipynb

This notebook comes from outside the course materials: it is shown here to read, not to run.

Rebuild the groove

Groove id: another_one_bites, be_my_baby, superstition Category: fidelity
Group: [removed]

Use drumkit.py and the Python standard library. Keep play(...) as the last cell: it is what we listen to.

from IPython.display import Audio
from drumkit import *

def play(wave, sample_rate=SR):
    return Audio(wave, rate=sample_rate, normalize=False, autoplay=False)

Tempo and grid

bpm = 114

step_s = 60 / bpm / 4   # one step = one sixteenth

Patterns

One track per instrument. Replace this example with what you hear.

# id: another_one_bites
bpm = 110
step_s = 60 / bpm / 4
#          1 e & a 2 e & a 3 e & a 4 e & a
tracks = [('x...x...x...x...',kick,step_s),
          ('....x.......x...',snare,step_s),
          ('x.x.x.x.x.x.x.x.',closed_hat,step_s),
          ('................',open_hat,step_s)]

another_one_bites = render_tracks(tracks)
# id: be_my_baby
bpm = 114
step_s = 60 / bpm / 4
tracks = [('............x...',kick,step_s),
          ('x.....x.x...x...',snare,step_s),
          ('............x...',closed_hat,step_s),
          ('............x...',open_hat,step_s)]

be_my_baby = render_tracks(tracks)
# id: superstition
bpm = 100
step_s = 60 / bpm / 4
#           1 e & a 2 e & a 3 e & a 4 e & a
tracks = [('........x...x...x...x...x...x...x...x...x...x...x...x...x...x...x...x...',kick,step_s),
          ('x...x.xx....x.......x.......x.......x.......x.......x.......x.......x...',snare,step_s),
          ('........x.x.x.xxxxx.x.xxx.x.x.xxx.xxxxx.x.xxx.xxx.xxxxxxx.x.x.xxx.x.xxxx',closed_hat,step_s),
          ('............x.......x.......x.......x.......x.......x.......x.......x...',open_hat,step_s)]

superstition = render_tracks(tracks)

Listen

play(another_one_bites * 4)
play(be_my_baby * 4)
play(superstition * 4)