Making stut a part of a pattern

Hello people,
I have this pattern

d1  $ fast 1
    $ stut 4 0.5 0.1
    $ sound "bd [[bd, cp] ~ ~ <cp ~ >]"
    # gain "1"

And I want to have only the first part of the cycle to stat (only the kick drum).
From what I can deduct, I need to make "stut" a part of a pattern maybe?
How can this be achieved?

You can use while with a binary pattern to apply a function to only a part of a pattern. With the binary pattern "10", the function will apply just to the first half:

d1 $ while "10" (stut 4 0.5 0.1)
   $ sound "bd [[bd, cp] ~ ~ <cp ~ >]"
3 Likes

Thank you!

There is a strange thing happening though,

d1  $ while "1 0" (stut 8 0.5 0.15)
            $ sound "bd cp"
        

The clap sound is getting stuted as well.
When I use 4 stuts, it sounds ok, but when the duration of the effect overlaps with the other sounds timing, the other sounds get stuted as well.
Do I do something wrong or is this expected behaviour?

Interesting - seems like unexpected behaviour to me.

Try the linger function

Yes this is expected in a way - while switches between the stuttered and the non-stuttered version of the pattern. So you get the tail of the stuttered clap, and miss the tail of the stuttered bd.

You can define a version of while that does what you want:

while' pb f pat = overlay (f $ mask pb pat) (mask (inv pb) pat)

It sounds better:

d1  $ while' "1 0" (stut 8 0.5 0.15) $ sound "bd cp"

Maybe there are times where you want the existing behaviour, though..

We could put both options in tidal, but I'm not sure what we should call them. One is selecting which events get the function applied, and the other is switching between the changed and original patterns.

I am tempted to change the current definition of while to the behaviour that's needed here, but not sure..

I don't know if it is possible in haskel, but a fourth optional, boolean, parameter in while (called overlap maybe) would be neat. :slight_smile: