Dynamic accent patterns in Tidal?

Hi friends.

I have a very simple problem that I can't wrap my head around in Tidal Cycles.

I want to create a pattern of accents for a rhythm, but I want to do this dynamically, depending on the size of the rhythm. Does anyone have good practices for this?

What I have in mind is something I do in Supercollider a lot where I store a rhythm in a variable as an array and then using the size of the array I can say that at the first onset I want an accent, then at the middle onset I want a slightly softer accent etc.

In this example I am doing it manually, but I would love to do it more flexibly so that the accents are dependent on the size of the ryt. Any ideas?

do
 let ryt = "0 0 0 0 0 0 0 0"
 let accents = "2 1 1 1 1.5 1 1 1"
 d1 $ fast 2 $ n ryt # s "808bd" # amp 1.0 |*| amp accents

this concept does not exist. an object (denoted by an expression) of type Pattern a does not have a size.

[EDIT] the above is my standard answer over many years now, but it seems that the world is changing ... viz.

ghci> :i Pattern
type Pattern :: * -> *
data Pattern a
  = Pattern {query :: State -> [Event a],
             steps :: Maybe Rational,
             pureValue :: Maybe a}
  	-- Defined in ‘Sound.Tidal.Pattern’

ghci> steps $ s "[bd sd [~ bd] sd, hc*8] " 
Just (4 % 1)

so there is some concept of size (number of steps) now? But what is it?

[INNARDS] You could still encode "at the start", "in the middle", relative to the unit interval of time. But - to model "at the start only", we would need zero-widt time invervals. For the complement ("not at the start"), we need (left) open intervals. It seems Arc s e currently means right-open (including s, excluding e).

So here's a project: add the missing interval types (three extra constructors for ArcF, so we get open/closed at left/right. Oh, and we should also have unbounded left/right.

This seems to be exactly it: https://hackage-content.haskell.org/package/data-interval-2.1.2/docs/Data-Interval.html#t:Interval ("provides both open and closed intervals and is intended to be used with Rational")

[EDIT] see https://codeberg.org/uzu/tidal/issues/1259