|> operator behaviour

I'm fairly new to tidal and am having trouble understanding how patterns are interpreted, in particular the |> operator.

For example, evaluating this ...

drawLine $ "2 3" |> "4 5 6"

... prints this, as I expected from reading docs:

4--5--|4--5--|4--5-- ...

But, evaluating this ...

s $ "2 3" |> "4 5 6"

... produces this very different structure:

(0>⅓)-½|s: "4"
0-(⅓>½)|s: "5"
(½>⅔)-1|s: "5"
½-(⅔>1)|s: "6"

I don't understand why they don't result in the same pattern of ints/rhythms.

Similarly, evaluating this ..

drawLine $ "1 2 3" |> "t"

... seems to print a pattern of Booleans:

tt|tt|tt ...

But something like this results in a syntax error:

s $ mask ("2 3" |> "t") "1 2 3 4"

So in this case ("2 3" |> "t") is clearly not being interpreted as a Boolean pattern, but I don't understand why.

Can anyone explain this?

They are different presentations of the same structure. The second one shows that the '6' is still there, it's just missing the first third of the event. It also shows that the '5' has been cut in half. The first presentation only shows the numbers with their 'onsets' intact. They're the ones you generally care most about, because sounds are triggered on onsets, so events without onsets don't make any sound.

drawLine expects a pattern of single characters, so it's parsing them as characters rather than booleans.

|> can only combine two patterns of the same type. So in this case I think the problem is that it's trying to parse "2 3" as a boolean pattern.

Thanks! That all makes a lot of sense now. One further question.

I'm used to seeing patterns represented like this:

(0>⅓)|s: "4"
(⅓>⅔)|s: "5"
(⅔>1)|s: "6"

... where (0>⅓) means the arc (?) is the first third of the pattern. But what does (0>⅓)-½ mean, from the example in my previous post?

(0>⅓)-½ means an event that's active for the first third of the cycle, but is part of one that continues until halfway. In other words an event that would have gone from 0 to 1/2, when the end of it is 'missing'. In the case of 0-(⅓>½) the start of the event is missing.

Thanks again!

I started writing a book here which tries to explain this sort of thing with diagrams: https://github.com/yaxu/pihkal/blob/master/pihkal.pdf

3 Likes