# Son clave, silly question

Hello everyone, I’m a newbie and already here with a silly question. Trying to use spread to create a Son clave 3 2 rhythm [ https://en.wikipedia.org/wiki/Clave_(rhythm) ]
and as far as now I’m just able to get a tresillo ( FWIW, I discovered later that there was the example of it in the spread page!) but I cannot figure out how to make the two bars of the whole rhythm, because I’m not able to stop the first loop for 1 bar and add the second part (that would just be -if we are in a 4/4 rhythm-, one quarter pause, one quarter note, one quarter note and one quarter pause) .
I also don’t understand spread’s behaviour when it is being used with x.times do. And maybe here lies the problem… In fact if I write
live_loop :clave do

1.times do
sample :elec_wood ,rate: 2 if (spread 3, 8).tick
sleep 0.125
end
1.times do
sample :elec_wood ,rate: 1 if (spread 3, 8).tick
sleep 0.125
end
1.times do
sample :elec_wood ,rate: 1.75 if (spread 3, 8).tick
sleep 0.125
end
end

the samples are played in another order: the first, the third and the second. Why?

Thank you very much!

Hi there.
First of all your code will be easier to read in future if you paste it preceded and followed by
three reverse ticks ````` on the line before and after. This will give:

``````live_loop :clave do
1.times do
sample :elec_wood ,rate: 2 if (spread 3, 8).tick
sleep 0.125
end
1.times do
sample :elec_wood ,rate: 1 if (spread 3, 8).tick
sleep 0.125
end
1.times do
sample :elec_wood ,rate: 1.75 if (spread 3, 8).tick
sleep 0.125
end
sleep 4
end
``````

You will see that I have added some extra lines which will enable you to follow what is going on. First thing to note is the the 1.times loops are not actually performing any useful function here as they merely perform the contents once and then continue. You get the same result if you miss them out.
Secondly, because you use tick in each sample line, this counter increases by 1 every time tick is issued, so in the first sample line tick is 0, in the second it is 1 and in the third 3, and then these increase to 4,5 and 6 on the next pass of the live loop and so on. IF you want to use the same counter VALUE for each, then only use tick for the first one and use look for the other two. This returns the current value of the tick counter without changing it. I use that in the additonal lines I have added to show the state of the counter for each of the sample play lines, and also whether it references true of false in the spead function. When it is true the sample will play, when false it wont. The spread function returns a ring, which means when ti reaches the end it starts again from the beginning. If you folllow through the values you should see now it works.

You can have separate tick counters in a loop by giving them different names eg tick(:foo) and tick(:bar) and they work independently.

Hope this is of some help to understanding what is gong on.

1 Like

What I don’t get is the way to have something like two different spreads ( or two different play(ring etc) one followed by another. I would like to have a rhythm of two seconds in which the first second is made by the spread(3,8) followed by the second part that would be : a 0.25 pause/a 0.25 note/a 0.25 note/a 0.25pause.
But it seems to me that when using spread with tick it just goes on and counts and I’m not finding a way to pause it like for 1 second and then go back to the beginning.
So, is there a way to accomplish this? Because I succeeded at doing it with a ring rhythm ( 0, 0.3333333, 0.66666, etc) but that is not the way I want to do that.

Hey @balbi,

It all depends on what you’re trying to end up with - are you wanting to have the different bars/segments played with different samples/different rates, within one single live_loop, like your original example shows?
this would do it:

``````live_loop :clave do
8.times do
sample :elec_wood, rate: 2 if patt1.tick
sleep 0.125
end
patt2 = (bools 0, 0, 1, 0, 0, 0, 1, 0)
8.times do
sample :elec_wood, rate: 1.75 if patt2.tick
sleep 0.125
end
end
``````

There are other ways to do the same thing of course (splitting the two segments between two live loops for example, or even concatenating the first and second segments together (spread and bools just create rings, which can be concatenated with `+`)). It all comes down to personal preference.

Let us know if you have more questions.

1 Like

Not sure how much this contributes to your goal but here’s another Son 2-3 clave implementation using delays instead of time stamps / booleans. Cowbell is just for fun and to provide an anchor.

``````use_bpm 85

live_loop :clave23 do
sleep 0.5
[0.5, 1, 0.75, 0.75, 0.5].each do |d|

with_fx :reverb, room: 0.7 do
sample snap
end
sleep d
end
end

live_loop :cowbell do
sync :clave23
if one_in(3)
7.times do
sample :drum_cowbell, amp: 0.5
sleep 1
end
sample :drum_cowbell, amp: 0.5
end
end
``````

Cheers,
Marc

1 Like

I think Ethan’s reply will probably help you out. It is certainly possible to have to different spreads used simutaneously for different samples.
I would probably do this with two separate live_loops one for each sample, but that’s not the only solution.

Thank you very much, now I get it!

Cheers,

a