Delay CHOP: output not what I expect?

Hello Forum,

What I have and want is tis:

A script CHOP generates an output of 32 channels with 16 samles each, coming from a two dimensional NumPy array. These channels form a whole and I want to be able to delay a complete set of these 32 channels with 16 saples for one (or more) frames.

However, when I use the delay CHOP and set the delay to one frame, the output is not 32 channels with a length of 15 samples, but 15 channels with a lenght of one sample:

So the output is not what I expected. Yhe warning sign indicates that I am ‘using an old export map format’, which I don’t fully understand either. I am definately making a mistake in where / how to get the output from the delay function. Can anyone shed some light on this?

Hi @pyromancer,

the Delay CHOP is Time Sliced (Time Slicing - Derivative) and will operate on the current frame (as controlled by the timeline) of data in the CHOP.

So the value that the Delay CHOP will be getting depends on the timeline’s current frame index.

You could change the sample rate of your Script CHOP to have 16 samples per frame (set the rate to 16*[timeline rate]) and append a Extend CHOP setting the Right Behavior parameter to “Cycle” so that every frame that the Delay will be looking into the input data will have the 16 values that you calculated in the Script CHOP.

Alternatively, instead of the Extend- and Delay CHOP, you could also use a Trail CHOP in combination with a Trim, where the Trim extracts only the first frame of the trailed channels…

More ideal though would be to delay the creation of the data. What is it based on? Is it dependent on an input?

For the warning, could you share a minimal replicable example that shows this behavior?

cheers
Markus

Thanks for addressing this! The way I interpret your quote, is that all CHOP data in the current frame should be processed. And as I set the delay to one frame, I expected to get the exact output of CHOP data coming from the script, but one (or more) frame(s) delayed. But I think I don’t fully comprehend the way Touch Designer handles frames, samples and channels yet.

This is a minimal working example from what I have now:

DelayUnexpected.tox (1.8 KB)

The reason I want this, is that need to perform logical operations on the chop data, operating on the current frame with delayed frame(s). As I need to have exact control over the output, I rather perform those operations in a script instead of existing CHOP operators or a TOP oriented opererator (eg feedback).

Hi @pyromancer

hm, without fully understanding the end result of your project, this is a bit difficult to advise on. But yes, generally you would want to understand more about how TouchDesigner interprets Frames and Samples. For non-Timesliced CHOPs, you can check on which frame would be currently processed via a Timesliced CHOP (like the Delay CHOP) by activating the CHOP viewer and the r-click menu’s Timebar checkbox.

Here I’m only displaying 3 of your generated channels and zoomed out a bit to see the 600 frames of the default timeline range:

Certainly some operations don’t lend themselves to be replicated in CHOPs or TOPs but operators can be more ideal as they are highly optimized vs the processing time required by the Script based operators. It does sometimes require a bit of extra operator wrangling.

If your script needs to operate on data from the last frame, you will still need to make use of a Feedback CHOP which returns the previous channel’s value. So if it is just the last frame’s data, the Feedback CHOP should be all you need.

For your direct question my recommendation would be a combination of the Trail and Trim CHOP as the Trail CHOP would allow for creating your own “buffer” and you can then trim out the portion you need. Attached an example with a component that gives you custom parameters to control the buffer size and the “delay” amount.

hope this helps
cheers
Markus
DelayUnexpected.5.toe (5.3 KB)

Hi Markus,

Thank you very much for following up so extensively. For my project, I need to be able to look one frame ‘in the future’, because the the pattern of the one but last frame influences the last frame.

After reading your first reply, I realised I will be transforming all the patterns to a TOP anyways, so I started looking in there for a solution as well. There I found the cache top. I use it now to delay the channel one frame and combine it with the last frame.

Coming from an embedded background, I tend to be conservative with using both memory and computing power. I thought a script working with boolean operators would be faster as performing actions with TOPs, as I tend to look at that more as ‘video’. But I am driving a matrix with a very small resolution compared to the average Touchdesigner project, and lack of computing power is probably the last last thing I have to worry about while using Touchdesigner for this project.

Having said that, I will certainly keep your advise in mind and use the Touchdesigner operators as first choice and scripting as second.

Cheers,

David

1 Like