Group 07

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 *

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

Tempo and grid

bpm = 117
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
tracks = [
    ("x.......x.......", kick, step_s),
    ("....x.......x...", snare, step_s),
    ("x.x.x.x.x.x.x.x.", closed_hat, step_s),
    
]

tracks2 = [
    ("x.......x.......", kick, step_s),
    ("....x.......x...", snare, step_s),
    ("x.x.x.x.x.x.x.x.", maracas, step_s),
    ("x.x.x.x.x.x.x.x.", closed_hat, step_s),
    ("-2.-7.-4.-2.-4.-7.-9.-7.", bass, step_s),
    
]

tracks4 = [
    ("x.......x.......", kick, step_s),
    ("....x.......x...", snare, step_s),
    ("x.x.x.x.x.x.x.x.", maracas, step_s),
    ("x.x.x.x.x.x.x.x.", closed_hat, step_s),
    ("-2.-7.-4.-2.-4.-7.-9.-7.", bass, step_s),
    ("0.....-1.........", melody, step_s),
    ("-5.....-6.........", melody, step_s),
    
]

tracks3 = [
    ("x.......x.......", kick, step_s),
    ("....x.......x...", snare, step_s),
    ("x.x.x.x.x.x.x.x.", maracas, step_s),
    ("x.x.x.x.x.x.x.x.", closed_hat, step_s),
    ("-2.-7.-4.-2.-4.-7.-9.-7.", bass, step_s),
    ("-3.....-1.........", melody, step_s),
    ("-8.....-6.........", melody, step_s),
    
]

bar = render_tracks(tracks)
bar2 = render_tracks(tracks2)
bar3 = render_tracks(tracks3)
bar4 = render_tracks(tracks4)

Listen

play(bar * 2 + bar2 * 4 + (bar3+bar4)*4)