Group 09

Download .ipynb

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

Rebuild the groove

Groove id: …
Category: fidelity / remix / mashup
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 *
from other_stuff import *

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

Tempo and grid

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

Patterns

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

#  1 e & a 2 e & a 3 e & a 4 e & a
intro_tracks = [
    (("x...x...xxxxxxxx" + "x..." * 4) * 2, kick, step_s)
]

tracks = [
    (("x." * 2) * 4, kick, step_s * 4),
    ((".x" * 2) * 4, snare_mid, step_s * 4),
    (("..x....." + "x..x.x.x." + ".xx...x" + "...xx.x." + "..............x." + ".xx...x...xx.x."), snare, step_s),
    (("xx.x.x.x" * 2) * 4, closed_hat, step_s),
    (("..x...x." * 2) * 4, open_hat, step_s)
]

bridge_tracks = [
    (("xxxxx.x." + "xxxxx.xx" + "xxx.xxxx" + "x.x....."), kick, step_s),
    (("xxxxx.x." + "xxxxx.xx" + "xxx.xxxx" + "x.x....."), snare, step_s),
    (("......xx"), snare_deep, step_s * 4)
]

# define bass sequence
bass_sequence = [
    0, 12, 0, 12, 7, 19, 7, 19, 9, 21, 9, 21, 9, 21, 9, 21, 
    2, 15, 2, 15, 7, 19, 7, 19, 9, 21, 9, 21, 9, 21, 9, 21,
    0, 12, 0, 12, 7, 19, 7, 19, 9, 21, 9, 21, 9, 21, 9, 21,
    2, 15, 2, 15, 0, 12, 0, 12, -1, 11, -1, 11, -1, 11, -1, 11
]
step_bass = step_s * 2

bassline = render_bass(43.65, bass_sequence, step_bass)

bar = render_tracks(intro_tracks) + mix(bassline, render_tracks(tracks) * 2, 1, 0.8) + render_tracks(bridge_tracks)

Listen

play(bar)