Some basic drum fills

use_bpm 80

CC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]
HH = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]
BD = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]
SN = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]
FT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]

16.times do
  tick
  sample "Hydrogen/GMRockKit/HatOpen-Med.wav",amp:0.5 if HH.look == 1
  sample :drum_bass_soft,amp:2 if BD.look == 1
  sample :drum_snare_soft,amp:2 if SN.look == 1
  sample :drum_tom_hi_soft,amp:2 if FT.look == 1
  sleep 0.5
  
end

--------------------------------------------

use_bpm 80

CC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]
HH = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]
BD = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]
SN = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1]
FT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]

16.times do
  tick
  sample "Hydrogen/GMRockKit/HatOpen-Med.wav",amp:0.5 if HH.look == 1
  sample :drum_bass_soft,amp:2 if BD.look == 1
  sample :drum_snare_soft,amp:2 if SN.look == 1
  sample :drum_tom_hi_soft,amp:2 if FT.look == 1
  sleep 0.5
  
end

-----------------------------------------
use_bpm 80

CC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]
HH = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]
BD = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]
SN = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0]
FT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
HT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]

16.times do
  tick
  sample "Hydrogen/GMRockKit/HatOpen-Med.wav",amp:0.5 if HH.look == 1
  sample :drum_bass_hard,amp:1 if BD.look == 1
  sample :drum_snare_hard,amp:1 if SN.look == 1
  sample :drum_tom_hi_hard,amp:1 if FT.look == 1
  sample :drum_tom_lo_hard,amp:1 if HT.look == 1
  sleep 0.5
  
end

-------------------------------------------
use_bpm 80

CC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]
HH = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]
BD = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]
SN = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1]
FT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]
HT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
n = 0
16.times do
  tick
  sample "Hydrogen/GMRockKit/HatOpen-Med.wav",amp:0.5 if HH.look == 1
  sample :drum_bass_hard,amp:1 if BD.look == 1
  sample :drum_snare_hard,amp:1 if SN.look == 1
  sample :drum_tom_hi_hard,amp:1 if FT.look == 1
  sample :drum_tom_lo_hard,amp:1 if HT.look == 1
  sleep 0.5
  break if n == 13
  n = n + 1
  
end

4.times do
  sample :drum_snare_hard,amp:1;sleep 0.25
end
------------------------------------------------



2 Likes

Hello - I’ve been trying your code (thank you!) to learn, and despite reading around/experimenting am still confused by tick - can someone explain the diff between
tick (as here)
puts tick (in the glossary)
xxx.tick (in the tutorial)
why does this example need n+1, if tick does +1 increments through an array as default?

The examples in the tutorials are a bit different, so I’m thinking again your example might be Ruby syntax I need to learn.
It sounds like ‘tick’ is hugely versatile if I can crack it!
Thank you anyone who can help.

Hi @rebelcello
I recently experienced some “unexpected” tick behaviour, while writing various rhythmic functions - purely because I’m a Ruby Nuby :smiley:

I found Sam’s comment here Creating values for a fade - #6 by samaaron very clear and succinct. I too have been doing some intermittent Ruby learning, to try to ‘think differently’ about Sonic Pi and live coding. Let’s see how we get on :wink:

PD-Pi

2 Likes

Great, thanks @brendanmac - I’m on the Ruby sidelines thinking prob need to dive in :smiley:

Sam’s comment is helpful, thanks. Having finally got head round i++/n+1 and arrays, I’m trying to relate this to what the tick functions do - a super-efficient way of handling incrementing?

Fear not, have had fun playing with other people’s code but the obstinate part wants to really grasp it :sweat_smile: We’ll get there. Will post anything if I get a ‘by jove, she’s got it’ moment

1 Like

I have put youtube video related to this drum fills:

Small tip, you can make the lists easier to read by using
bd = "x---x---x---x---"
and
if bd.look == 'x'

1 Like