Group 10

Download .ipynb

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

Rebuild the groove

Groove id: when_doves_cry
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)

def rimshot(sample_rate=SR):
    duration = 0.02 
    n = round(duration * sample_rate)
    
    pitch_high = [1500] * n  
    pitch_low = [500] * n  
    wave_high = square_wave_f(pitch_high)
    wave_low = square_wave_f(pitch_low)
    body_wave = mix(wave_high, wave_low, ga=0.7, gb=0.8)
    
    body = edge_fade(body_wave, attack=0.001, release=0.02, sample_rate=sample_rate)
    
    noise_dry = noise(duration, sample_rate=sample_rate)
    le_molle_sotto_il_rullante = edge_fade(noise_dry, attack=0.001, release=0.03, sample_rate=sample_rate) 
    #TERRIBLE variable name but idk the name of the cordiera in english 
    return mix(body, le_molle_sotto_il_rullante, ga=1.0, gb=0.3)


#i had thought of this rimshot while in class and worked better with a triangular wave, but im already adding
#one function to this and idek if it's possible but since i picked fidelity i went with this
#this track NEEDS the rimshot, so i tried to write a similar sound 

Tempo and grid

bpm = 126 #tracks bpm
step_s = 60 / bpm / 2   # half step = one eight

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_intro = [
    ("x..x....xx..xxx.", kick, step_s),
    ("..x.............", open_hat, step_s),
    (".xx.......xx....", rimshot, step_s),
]
tracks_drop = [
    ("x..x....xx..xxx.", kick, step_s),
    ("...x......xx..x.", snare, step_s),
    ("..x.............", open_hat, step_s),
    (".xx.......xx....", rimshot, step_s),
]

bar1 = render_tracks(tracks_intro)*4
bar2 = render_tracks(tracks_drop)*4

Listen

play(bar1+bar2, SR)