Prevent dice roll until .look is completed?

Hi
I am trying to add some simple random drum fills - and I’ve seen Davids Fiddle’s nice example. My own early test has two very simple patterns, a straight 4 on the floor kick, or a 2 beat skip fill, but my dice roll sometimes exits the full fill before it’s finished - and then the straight kick is on the upbeat. Is there a way to say “play straight, or do the full fill” so that the next straight beat is on the down beat?

I got myself all tied up in density (which is excellent btw) and other random conditionals; trying to keep this as simple as possible.

live_loop :tok do
  #stop
  play 72, release: 0.2
  sleep 1
end

live_loop :mainBeat do
  tick
  fill = one_in(4)
  
  sample :bd_haus
  if fill
    sleep [0.25,0.5,0.25,1].look #skip fill
  else
    sleep [1,1].look #downbeat
  end
end

PD-Pi

1 Like

I would probably do it like this:

live_loop :beat do
  tick
  sample :bd_haus if (bools 1,0,0,0).look  || do_fill && (bools 1,1,0,1,1,0,0,0).look
  sleep 0.25
end

Also, are you referencing an older video or is my username displayed wrong?

Hi @Davids-Music-Lab
thanks for the suggestion; I altered it and got the behaviour I was after, a steady beat with occasional skips in the kick. Thanks for pointing me in the right direction.

live_loop :beat do
  tick
  str = [1,0,0,0]
  skp = [[1,0,0,1],[1,1,0,0]].choose
  snr = [0,0,1,0]
  
  sample :bd_haus if [str.look, skp.look].choose == 1
  sample :sn_dolf if snr.look == 1
  sleep 0.25
end

And yes, I think it’s an old resource of yours,The Smallest Drum Machine:

Thanks
PD-Pi

1 Like

. . . although I have to admit, in your example, although I know that || && denote logical or and and, I don’t know what they’re doing exactly @Davids-Music-Lab

PD-Pi

AND is evaluated before OR, so when do_fill is false, it plays four on the floor and when it’s true is also plays the fill pattern.

1 Like