Random polymetric divider ({}%n)

Hi im new in cycles and i want to generate a casual number with irand ,and link it with the %n of the polymeter divider.

Ex. d1 $ s "{ bd cp hh }%randomvalue".

How i can concatenate the integer random value in that string pattern?

thanks :slight_smile:

Ciao! You can define a variable like:

setI "value" (irand 8)

and then use in you pattern with the prefix ^:

d1 $ s "{bd cd hh sd}%^value"

PS: you have an italian name, if you are italian you can join the italian livecoding community: https://toplapitalia.gitlab.io/ )


Thank you so much, it worked ,and thanks for the link too.
Can you tell me were i can find some documentations on types declarations string addition and so on?idk if i had to find for haskell or tidal

Is there anywhere in the documentation that explains how this works?

Don't think so, but feel free to open an issue in the tidal-doc repository: GitHub - tidalcycles/tidal-doc

Is there a way that I can use a variable to select my sample as well? Like something like this:

setI "value" (irand 8)

d1 $ (|+ (n value)) $ s "{hh*16}"

d1 $ s "{hh:^value*16}"

Both of these options throw an error.

d1 $ (|+ (n "^value")) $ s "{hh*16}"
should work

Didn't really know what's the deal with that caret operator ^ and thought it's some Haskell specific syntax. But I found this issue here and apparently it's something that was introduced to TidalCycles sometime ago. This should be in the docs. :point_up_2:

you could add it if you have time, or

setI "value" (irand 8)

What is the advantage to use a variable like this above?
Doesn't this have the same effect?

d1 $ s "hh*16" # irand 8

yes that is indeed equivalent, if you look at the original question of this thread it becomes more clear why it is nice to have

Thank you for the hint @polymorphic.engine. I should try out working with these examples { }%about polymetric sequence subdivision.