Saving data

First of all, a question:
Is data sharing intrinsically hard to achieve in haskell? i.e. passing values in arbitrary ways from one pattern to the other, etc.
All I really could gather from the various haskell docs I've read is that variables are by and large, constant? (This could pose an obstacle in this instance I suppose).

I'm asking this cause the lack of this sort of thing is the only reason I sometimes rather work strictly in SC. Besides that Tidal is the bees knees and the cats pyjamas.

I've been writing a class library in SC for sequencing control data with shift registers. Feeding
a sequence in at one end, shifting the register at some rate, and passing whatever is in the middle as an argument to some Ugen. This Allows for some pretty interesting conditional dependencies.
Like, "If the snare is going to be reverbd in two beats, play the open hihat right now".
This works with whatever you put into the register, completely randomized sequences or whatever.

The dream for me would be to feed the Osc stream going from tidal into these shift registers before it hitting the SuperDirt samplers. Then all sorts of "time traveling conditional shenanigans" would be possible.

I sat down the other day to set this up but quickly realized it would be quite some work to integrate properly and my day job is pretty hectic atm.
So, my other question:
Are there any libraries out there that extends this part of tidal?
(data sharing/saving data for later use/etc)


I'm not able to try this idea at the moment, but perhaps you can do this with combinations of mask or while.

mask is like a gate pattern that will turn a pattern on or off.

while would allow you to apply a function conditionally, using the same mask pattern.

So the idea is to define a single binary pattern of 1's and 0's and then use that for both the mask and while patterns to turn things on and off using the same logic.

There's also squeeze and pickF.... which might allow you to do these things based on lists of indexes rather than binary gates/patterns.

Just an idea! :man_shrugging:
(there is no doc for while yet)

Hmm yeah that sounds interesting. I'm gonna try to pull this of later.
I'd like to see that in code if you try it out also.
The shift register thing is harder to pull off though i think?

Here comes a tangent:

I can't find the specific source right now, but I read someone describing what he/she called the "orders of conditional logic in musical composition" or something. He/she described
the first order as having conditionals depend on events in the present, i.e. "if this thing happens right now, this other thing will also happen right now", the second order was having conditionals depend on past events, i.e. "if this thing happened x beats ago, this other thing will happen right now".
This got me thinking about how to achieve the third order, i.e. "if this thing will happen in x beats, this other thing will happen right now". Enter shift registers. They let you do all three with quite a lot of flexibility. The downside of this approach is that the amount of time you want to look into the future is added to the latency of the system.

I have implemented this in vanilla SC in a way that automatically sets up shift registers for every argument of whatever SynthDef you .add and then some classes to make sensible use of those registers.
I feel like it would be a fun project to try and set up in between Tidal and SuperDirt.

Hmmm, Could this possibly be done with <~ or ~> through your approach??