Tidal v2.0 will have a lot more ways of combining patterns, an approach already trialed in strudel.
Currently strudel has 7 ways of combining the structure of two patterns (In, Out, Mix, Squeeze, SqueezeOut, Trig, Trigzero
) and 25 ways of combining two values within those patterns (set, keep, keepif, add, sub, mul, div, mod, pow, _and, _or, _xor, _lshift, _rshift, lt, gt, lte, gte, eq, eqt, ne, net, and, or, func
). They combine to create 7 * 25 = 175 methods for combining two patterns.
For example keepif
and Out
create the method keepifOut
, which is actually equivalent to Tidal's struct
. setIn
is equivalent to Tidal's #
operator. addOut
is equivalent to +|
, mulMix
to |+|
and so on.
Strudel uses these names as methods, partly because in javascript it's not possible to define new operators like #
or |+
. But with 175 ways of combining patterns, and more ideas to come that would add even more, maybe it's difficult to find so many operators to stand in for these names.
Here's how things look in strudel:
(we could have just used squeeze
here instead of setSqueeze
, as the default behaviour is to set the value)
Currently in Tidal 1.9.0 this is possible with
s "hh [~ hh] hh hh" ||> speed "1 1.2"
In the ||>
operator, ||
indicates squeeze (squeeze cycles from the right into events on the left), and >
indicates set (set values from the right). ||
kind of suggests squeezing (like being squashed between walls in star wars)
Is it possible to continue this logic with all this new functionality?
Another example is trig
, e.g.:
The binary pattern is resetting the s
pattern whenever there's a true value (reset
is an easier-to-remember alias for keepifTrig
).
Maybe !
could stand for this retriggering, and ?
for keepif, giving the Tidal operator !?
..
s "bd hh*2 bd*3 cp" !? "<t t t*2 [~ t]>"
In this case reset
could be a prefix alias, i.e.
reset "<t t t*2 [~ t]>" $ s "bd hh*2 bd*3 cp"
But then we might want to retrigger a pattern with speed
values like
s "bd hh*2 cp sn" !> speed "<1 1.5 [2 2.5*8]>"
Which in strudel is:
Using a prefix function for this in tidal would be a bit awkward:
setTrig (speed "<1 1.5 [2 2.5*8]>") $ s "bd hh*2 cp sn"
Using a name as infix using backticks is also possible in haskell:
speed "<1 1.5 [2 2.5*8]>") `setTrig` s "bd hh*2 cp sn"
But having a lot of backticks in patterns feels like it would get messy too.
So mostly thinking aloud here.. But interested if others have ideas for making nice syntax for combining patterns. Mostly people use #
for combining patterns in Tidal but there's a lot of other different possibilities opening up here..