# Help with this generative midi drum pattern

**URL:** <https://in-thread.sonic-pi.net/t/help-with-this-generative-midi-drum-pattern/5068>\
**Category:** General\
**Created:** [January 30, 2021, 2:48pm UTC](https://in-thread.sonic-pi.net/t/help-with-this-generative-midi-drum-pattern/5068 "2021-01-30T14:48:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![soundwarrior](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@soundwarrior](https://in-thread.sonic-pi.net/u/soundwarrior)\
**Post date:** [January 30, 2021, 2:48pm UTC](https://in-thread.sonic-pi.net/t/help-with-this-generative-midi-drum-pattern/5068/1 "2021-01-30T14:48:00Z")

</div>

set( :rnd, 5683 )

live\_loop :drums do  
use\_bpm 140  
use\_random\_seed get( :rnd )

8.times do  
midi :B1, channel: 10  
midi :C2, channel: 10  
midi :C3, channel: 10  
midi :F2, channel: 10

```
sleep 1.3

```

end  
end

live\_loop :controller do  
set( :rnd, rand\_i( 200000 ))  
sleep 1  
end

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [April 14, 2021, 8:43am UTC](https://in-thread.sonic-pi.net/t/help-with-this-generative-midi-drum-pattern/5068/2 "2021-04-14T08:43:34Z")

</div>

Hey @soundwarrior,

what kind of help are you looking for?

Quickly reading the code I can see that you’re sending Midi notes B1, C2, C3 and F2 to all connected MIDI devices on Chanel 10 every 1.3 beats (with the BPM set to 140). With the `midi` function Sonic Pi will automatically send both note on and note off events (with a default of 1 beat between them) so this should act like someone hitting those notes on a piano and keeping their fingers down for 1 beat.

You also look to be playing with randomisation although you just seem to be calling `set` and `get` passing random values, setting the seed with `use_random_seed` but never actually doing anything that is random.

What were you intending to do? If you can let us know I’m sure we can help you towards your goal 🙂
