# Some basic drum fills

**URL:** <https://in-thread.sonic-pi.net/t/some-basic-drum-fills/9066>\
**Category:** Creations & Ideas\
**Created:** [July 22, 2024, 2:23pm UTC](https://in-thread.sonic-pi.net/t/some-basic-drum-fills/9066 "2024-07-22T14:23:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinodv](https://avatars.discourse-cdn.com/v4/letter/v/97f17d/32.png) [@vinodv](https://in-thread.sonic-pi.net/u/vinodv)\
**Post date:** [July 22, 2024, 2:23pm UTC](https://in-thread.sonic-pi.net/t/some-basic-drum-fills/9066/1 "2024-07-22T14:23:51Z")

</div>

```ruby
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
------------------------------------------------

```

---

<div class="post-metadata">

**Author:** ![rebelcello](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/rebelcello/32/2602_2.png) [@rebelcello](https://in-thread.sonic-pi.net/u/rebelcello)\
**Post date:** [July 23, 2024, 8:26pm UTC](https://in-thread.sonic-pi.net/t/some-basic-drum-fills/9066/2 "2024-07-23T20:26:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![brendanmac](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/brendanmac/32/2809_2.png) [@brendanmac](https://in-thread.sonic-pi.net/u/brendanmac)\
**Post date:** [July 23, 2024, 8:40pm UTC](https://in-thread.sonic-pi.net/t/some-basic-drum-fills/9066/3 "2024-07-23T20:40:01Z")

</div>

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

I found Sam’s comment here [Creating values for a fade - #6 by samaaron](https://in-thread.sonic-pi.net/t/creating-values-for-a-fade/5003/6) 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 😉

PD-Pi

---

<div class="post-metadata">

**Author:** ![rebelcello](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/rebelcello/32/2602_2.png) [@rebelcello](https://in-thread.sonic-pi.net/u/rebelcello)\
**Post date:** [July 23, 2024, 8:53pm UTC](https://in-thread.sonic-pi.net/t/some-basic-drum-fills/9066/4 "2024-07-23T20:53:18Z")

</div>

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

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 😅 We’ll get there. Will post anything if I get a ‘by jove, she’s got it’ moment

---

<div class="post-metadata">

**Author:** ![vinodv](https://avatars.discourse-cdn.com/v4/letter/v/97f17d/32.png) [@vinodv](https://in-thread.sonic-pi.net/u/vinodv)\
**Post date:** [August 4, 2024, 3:59am UTC](https://in-thread.sonic-pi.net/t/some-basic-drum-fills/9066/5 "2024-08-04T03:59:44Z")

</div>

I have put youtube video related to this drum fills:

[![](https://img.youtube.com/vi/3kByrUwjG7k/maxresdefault.jpg "Drum fills with Hydrogen drum kit") ](https://www.youtube.com/watch?v=3kByrUwjG7k)

---

<div class="post-metadata">

**Author:** ![Davids-Music-Lab](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/davids-music-lab/32/512_2.png) [@Davids-Music-Lab](https://in-thread.sonic-pi.net/u/Davids-Music-Lab)\
**Post date:** [August 4, 2024, 7:36am UTC](https://in-thread.sonic-pi.net/t/some-basic-drum-fills/9066/6 "2024-08-04T07:36:38Z")

</div>

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