Skip to content

Instantly share code, notes, and snippets.

@tomhayes
Last active April 10, 2019 22:14
Show Gist options
  • Save tomhayes/553cdc77747c485efdb834bf6254118e to your computer and use it in GitHub Desktop.
Save tomhayes/553cdc77747c485efdb834bf6254118e to your computer and use it in GitHub Desktop.
Sonic Pi Drum Sequencer
#DRUM SEQUENCER
use_bpm 125
#PATTERNS (1=on, 0=off, 8 steps but add more if needed)
kickpattern = (bools 1,0,0,0,1,0,0,0)
snarepattern = (bools 0,0,0,1,0,0,1,0)
hatpattern = (bools 1,0,1,0,1,0,1,1)
#RESOLUTION (set step resolution in 0.25s)
seqres = 0.25
#MIXER (set volume between 0-1)
kick_vol = 1
snare_vol = 1
hat_vol = 1
#MUTES - turns individual drums on(true)/off(false)
kick_on = true
snare_on = true
hat_on = true
#the sequencer brain
live_loop :kick do
if kickpattern.tick and kick_on
sample :drum_heavy_kick, amp: kick_vol
end
sleep seqres
end
live_loop :snare do
if snarepattern.tick and snare_on
sample :drum_snare_hard, amp: snare_vol
end
sleep seqres
end
live_loop :hat do
if hatpattern.tick and hat_on
sample :drum_cymbal_closed, amp: hat_vol
end
sleep seqres
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment