Every but for pattern events?

I'm looking for a function or workaround to apply a function to every x event of a pattern. Preferably in a way that carries over to the next cycle. Like this example:

-- InsertFunctionName 3 (# speed 2)
$ s "bd sd clap ch"

would speed up clap for the first cycle, sd for the second and bd for the third and so on.

Also, how do I make that fancy highlighted code?

I do this with inside, but you need to specify how you're subdividing the pattern. If you're breaking it into 4, then:
d1 $ inside 4 (every 3 (# speed 2)) $ s "bd sd clap ch"

Fwiw, because I use this so much (and because I hate typing parentheses), I made a custom function for my BootTidal.hs:
inevery div freq f = inside div (every freq f)

This way I can just type:
d1 $ inevery 4 3 (# speed 2) $ s "bd sd clap ch"

on reflection, this isn't exactly what was asked for. every 3 applies its function to the first cycle, then every third cycle after that. In the example above that would be bd first, then ch, then clap etc. If you wanted to start on the third element you would need to use every' 3 2 or whenmod 3 2 as in

d1 $ inside 4 (every' 3 2 (# speed 2)) $ s "bd sd clap ch"


I recently learned about inside and outside which seem super useful. To the original question, how would weave differ from the inside approach?

Also, you can turn text into code with 3 back quotes before and after the text you want to be seen as code ``` @C-o.

Oh, this is great. thank you!

Thank you :^)

1 Like

@C-o have you tried within ?