How to trigger patterns in a cat sequence conditionally?

Hi all!

I've been trying to make a pattern that's part of a cat sequence trigger only once every 4 cycles. Here's my code, which I know isn't working cause I lack the necessary arguments to the every function:

$ slow 2
$ cat[
    n "d4 f4"
    , n "d4@2 f4 a4"
    , every 4 (n "{d4@5 c4@2 f4@2 e4@5}%4")
]
# s "DN"
# midichan 0
# gain 1.2

How can I go about adding this last pattern while still making it trigger only on its fourth repetition?

I'm not sure that you can do that with cat, but how I'd approach it would be to completely override the cat pattern with a const:

$ slow 2
$ (every 4 (const $ n "{d4@5 c4@2 f4@2 e4@5}%4") 
    $ cat [
        n "d4 f4"
        , n "d4@2 f4 a4"
    ] )
# s "DN"
# midichan 0
# gain 1.2

Disclaimer: I have not tested this code.

const is a very common trick I use to completely change a pattern conditionally.

2 Likes

You could use mask

cat[
    n "d4 f4"
    , n "d4@2 f4 a4"
    , mask "<t f f f>" (n "{d4@5 c4@2 f4@2 e4@5}%4")
]

or maybe mask "<t f!3>" is clearer

3 Likes