Pattern rotation, but changing structure

Hey folks! I suspect the answer to this is staring me in the face somehow, but for some reason I can't see it - I'm looking for a way of rotating a pattern, including it's structure, so that eg

rot' 1 $ n "0 1 1 ~ 1 1 ~ 1 ~ 1 1"

would give back something like "1 1 ~ 1 1 ~ 1 ~ 1 1 0".

the rot function isn't quite it, as it just rotates the events that aren't rests, giving: "1 1 1 ~ 1 1 ~ 1 ~ 1 0".

Any idea if anything like this exists, or clues on how to implement it? I tried using cat and trunc but fell down when I realised i coudn't find a way to get the number of events in the pattern.

Thanks!

Tim

3 Likes

There's an operator <~for this, e.g. (1/11) <~ (n "0 1 1 ~ 1 1 ~ 1 ~ 1 1")

It has the alias rotL as a function rotL (1/11) $ n "0 1 1 ~ 1 1 ~ 1 ~ 1 1"

The advantage of the <~ is that you can pattern it e.g. "<1%11 5%11>" <~

4 Likes

Aaah thank you Alex! That's exactly what I was after (I actually tried rotL which initially gave some odd results, but now I realise I was dividing by 12, not 11 :joy:)

2 Likes