Incrementing values with each cycles

Hey community,

for a upcoming performance I'm working on a piece where a pattern should be repeated increasing one repetion per cycle. Is there an elegant way to do that?
I know in haskell there is the possibility to create this kind of lists:


Would be very cool to be able to create something similar with a maximum that is reached at some point
So my ideal function would look something like this:

d1 $ s "bd*[1,2..100]"

so first cycle you hear 1 bass drums, second 2, third 3, and so on and so on

Any thoughts?

something like this?

d1 $ squeezeJoin (fmap  (\ k -> _fast (1 + k) (s "bd")) $ run 4)
-- or
d1 $ d1 $ squeezeJoin (fmap  (\ k -> fast (1 + pure k) (s "bd")) $ run 4)

here, the local name k takes on values 0, 1, 2, 3 that come from the (outer) pattern run 4. The resulting pattern of patterns is flattened by Sound.Tidal.Pattern (the function's name is in the URL but the auto-formatter hides it)

if you want part A, then two times part B, etc., (without increasing speed), then perhaps

d1 $ slow 4
   $ timeCat (map (\ k -> (k, _fast  k $ s "superpiano" # note  (fromRational k))) [1 .. 4])

using Sound.Tidal.Core

[comment] yes, global composition sometimes feels a bit clumsy, in comparison with other computer music systems that more closely model the concept of a "score" - that has a duration, and therefore, allows concatenation (and repetition), which Tidal (version < 2) does not - the function that's called cat is actually "interleaving".

I feel that's by design, Tidal is for (local) patterns, not (global) scores, and usually the global structure is in the live coder's mind - not in the visible code.

Cool thanks this here kind of did the trick for me, i used ply instead of fast because each cycle it gets faster.

d1 $ slow 66 $ squeezeJoin (fmap  (\ k -> _ply (1 + k) (s "bd")) $ run 66)

Only problem it doesn't stop at the end but then run goes back to 0

... stop at the end

that's tricky, because in tidalcycle semantics, a pattern has no end. A pattern is a function that maps an interval of time to a set of events. This function can be modified to return the empty set when the time is outside some range. The following plays c,d,e then goes silent (it ignores f)

d1 $ mtrigger 4 -- to hit the start of a period of our pattern below
   $ filterWhen (< 3)     -- play cycles 0, 1, 2.
   $ filterWhen (>= 0)   -- see comment in :doc qtrigger 
   $ s "superpiano" + note "<c d e f>" -- pattern with period 4