CHOP streams of values synchronicity?

Hi there,

maybe this is a question that doesn’t make sense here (but some of you know I’m coming from Max and I need to figure out how to retrieve concepts I know and how it works in TD)

In Max, there is the task scheduler.
Messages are NEVER received exactly at the same moment, but consecutively (even if VERY VERY closely)

If I export values from 3 CHOPs Beat, for instance, to RGB value of a Constant TOP, is there some priorities I’d need to know for my stream ? I mean, is there a rule that makes my first value (the most at the top, or the most at something) to be received first ? then the 2nd etc ??

Is it the same if I connect nodes directly ? (I mean, against exporting)
For instance, a combine CHOP fed by 3 values, which one is processed/received at first ?

As fas as I understood, I thought CHOPs were related to sampling rate, so, emitting values always. But I’m now confused. DAT seems to be close to message level in Max (message & matrices) as we need to bang, to ask to a DAT node to cook and pop out.

Any discussions about this would help me a lot.

Hi @julien !

Things work a little differently in TouchDesigner. In Touch, the system uses a pull mechanism to analyze the dependency graph (If node D is the final output, and C feeds into D, and A and B feed into C, the depdency graph ((A)+(B)) → C → D will be created and then executed.

Every node is a separate high level function. As a side note, every TOP is a separate openGL call. Therefore, there is always a valid sequential set of operations to execute.

At the same time, note that the depth of cooking is dynamic. So let’s say nodes A and B are large images on disk (moviefilein TOP), node C is an operation that can be static (like the Blur TOP), and then node D is dynamic, (like a level TOP with an animated parameter). TouchDesigner is smart enough to understand that A and B won’t change, therefore C won’t change, but D would still change. So basically on the first frame, the images in A and B would cook once, pass into C which would cook once, and then pass into D that would cook once. On frame two, A and B don’t update, so C doesn’t need to update, but D has and animated parameter so D would be the only operator that would cook on frame 2 or any subsequent frame, unless something changes with nodes A, B, or C.

1 Like

Thanks a lot, @pointshader.
And I also progressively understand why TD is so optimized.

Actually, I also understood that CHOP, in case of multiple channels cooked, are cooking everything at each frame (if required, I mean, considering your explanation)… I mean, synchronously.

I’d say:

  • a one channel CHOP gives samples (consecutive values over time), reminding me float or integer single item list generator in max
  • a multiple channel CHOP gives channels (multiple flows of samples, each sample of each flow cooked at each frame and the whole popped out together simultaneously), reminding me lists in Max (which are pretty different) … actually this is more like multichannel objects in MSP (would need to dig the analogy, I’m not completely ok with that, btw)

thanks a lot for the whole explanation about the graph etc.

1 Like

(Looks like the second part of my answer wasn’t included)
To answer the second part of your question, essentially all parameters necessary for the operator’s function to execute are collected and evaluated right before the execution of the main operator code. The order of the parameter evaluations for a specific operator do not have a guaranteed order of operation, but since TouchDesigner works with a frame based execution system, and each operator is essentially a function with (# of parameters) arguments, it “doesn’t matter”.

To reply to your reply, it’s actually even more complicated. The number of operation modes of a chop are ( Single Channel or multi channel ) * (Single Sample or Multi Sample) * (Timeslicing On or Off). But to start off, just grasping the 2x2 matrix of single/multi channel vs single/multi sample will go a LONG ways towards making the chops intuitive. Because unfortunately, most chops literally change what they do in between single sample and multi sample mode, which can be quite confusing at first.

In max, for audio cables there’s always a set number of samples (your sample rate), defaulting to a single channel (unless you use multichannel objects).
In max, for message cables, there’s only every 1 sample (which is executed at your scheduler poll rate). Lists in max would be the equivalent of a single sample but multi channel.

Timeslicing sits on top of all of this. Basically, if your project is set to 60 fps and the sample rate of the chop is 60fps, but you drop to 30fps because your frames are heavy, how should the missing/extra data be handled? TouchDesigner timeslices, and automatically calculates that if the project WAS running at 60fps that there would have been 2 samples calculated, and delivers BOTH samples as it’s output. This makes the mode switch to multisample mode, and can be the source of hard to detect bugs in more advanced CHOP networks.

I highly recommend reading the following articles if you’re digging this deep.

https://docs.derivative.ca/CHOP (Difference Between a Sample and a Frame section)
https://docs.derivative.ca/Time_Slicing
https://docs.derivative.ca/Extend_Conditions