I recently stumbled across a delay using an Engine COMP that I couldn’t figure out why. The live webcam feed received inside an Engine COMP had a great delay, and it turned out that most of the delay is created when the image gets out of the engine into the main toe. It was much snappier when using an NDI Out TOP from the Engine COMP into an NDI In TOP in the main toe. I made a little test patch and compared different ins and outs, finding out that the Shared Mem TOP wins (also with CHOPs) and is up to 10-12 frames earlier than the ‘native’ ins and outs. I had the impression the larger the texture, the less delay has the engine outs, but that wasn’t really consistent. Attached are the files to check this locally.
I was curious on some insights, or rules that one can follow in choosing the right Ops?
engine_outs.toe (4.0 KB)
top_and_chop_out.tox (886 Bytes)
Keep up the great work!
Hi Daniel - thanks for the neat example
The Engine COMP by default buffers input and output to smooth over frame timing fluctuations between TouchDesigner and TouchEngine - especially important to avoid dropouts if you’re using time-sliced CHOPs.
You can control the buffer on the Tune page of the Engine COMP’s parameters - in your example, turning off Out Buffer Auto and setting Out Buffer Frames to 1 makes the Engine TOP Outs faster than the other methods. Note that the number of frames buffered isn’t a guarantee that frames will be ready unless you also turn on Wait for Render - but be careful with that - waiting impacts TouchDesigner’s framerate, negating some of the utility of TouchEngine if TouchDesigner has to wait every frame.
Hopefully you can find settings which work for your scenario. If latency is a priority, I’d probably turn it to 0 but leave Wait for Render Off, then you’ll get frames as soon as they are available without slowing TouchDesigner (as long as you don’t have time-sliced CHOP Outs from the same component).
Please may I ask what happens in case one has time-sliced CHOP outs from the same component? (Just curious )
@monty_python one of the great things about the Engine COMP is that it separates a component from the frame-rate of TouchDesigner - the component needn’t slow TouchDesigner down if it’s doing some heavy work, nor is it affected by fluctuations in TouchDesigner’s frame-rate. Because of this, time-sliced CHOP output from TouchEngine is unlikely to match, per frame, the number of slices expected in TouchDesigner. Using a buffer lets the Engine COMP re-slice the output from TouchEngine to match what’s needed for each frame in TouchDesigner, without dropping any samples. This applies to inputs too, so the input buffer queues up samples so TouchEngine can re-slice inputs appropriately.
A few things factor into this: the clock mode, whether the Engine COMP waits for frames to complete, and the frame-rates of TouchDesigner and TouchEngine. The “Auto” parameters simply increase the buffer size when samples are dropped - if latency is important and you can tolerate dropped CHOP samples then the buffer can be fixed at a low size.
Audio is a good way to experiment with all of this - the ear can detect dropped samples quite well. The Info CHOP for the Engine COMP gives some more detail - even more in the next experimental build we will release.
The buffers can be useful even when there isn’t CHOP input at all as they smooth fluctuations in framerate for any In or Out.
@bangnoise thank you very much for explanation!
super helpful, thank you @bangnoise
amazing. The answer I was wishing for - understanding more and more the TouchEngine every time I use it. Your explanation makes total sense, and I adjusted the tune settings for this Engine COMP towards lowest latency.
I am integrating the Engine COMP into my patches a lot. And I am looking forward to the new features arriving in the next experimental.
Thanks again for the fast reply and thorough explanation.