Time Slicing is a feature in TouchDesigner that keeps your CHOP channels smooth, even when your overall frame rate goes down. This keeps your overall animation smoother and more accurate, and helps keep your audio from popping when your frame rate drops.
A Time Slice is the time between the last cook frame and the current cook frame. (See Absolute Time.) In CHOPs it is a set of short channels that only contain the CHOP channels' samples between the last and the current cook frame. You can see the time slice sizes by creating a Perform CHOP and sending it to a Trail CHOP and setting Perform to the Cook and Time Slice Step channels,
Most CHOPs cook a timeslice of channels to assure that curves are smooth and and pulses are accurate, even if the TouchDesigner process is skipping frames.
Time Slice is a Common page parameter on each CHOP and is automatically determined on most CHOPs.
Example: If the current frame is 77 and the previously-displayed frame is 73, then the time slice is 4 frames long (frames 74 to 77). This means that TouchDesigner jumped ahead 4 frames to keep up with the real-time clock. Assuming the frame rate is 60 frames per second, if the CHOP is audio at its default 44100 samples per second, there will be more samples, 44100*4/60 = 2940 samples in this example.
You can check if a CHOP is time sliced via the MMB info pop-up on any CHOP node.
Note: The maximum length of a time slice is set via the preference in Edit -> Preferences -> CHOPs. It is currently 200 msec. See the audio tip in Audio Device Out CHOP.
These short channels can be computed much faster than a full animation range channel, and uses less memory. This gain in speed and memory efficiency is extremely important for interactive 3D, puppeteering and audio processing.
CHOPs often calculate the channel over a long start-end frame range. This is a good method for pre-animated channels and keyframed channels which do not need to be re-generated or re-calculated each frame.
However, if the channel does need to be evaluated every frame due to user input (with for example a Mouse, Keyboard or MIDI CHOPs) or other realtime data input, and we are only interested in the values over the last few frames, then cooking the entire range of the channel is unnecessary. It is more efficient to calculate only the fraction of the channel that is needed. This fraction is known as a "Time Slice".
When you view the info on a CHOP, it reports its frame range and whether it is time sliced or not.
To Time Slice a CHOP, set its flag on the Common page. Try the Noise CHOP to see the effect with Time Slice On and Off.
With Time Slicing, samples do not get lost or un-processed when TouchDesigner cannot keep up with the timeline's sample rate, default 60 frames per second. All frames get processed, albeit in batches of 1, 2 or more at a time. This gives TouchDesigner more accurate curves and timing.
Time Slicing especially reduces the memory requirements of high sample-rate CHOPs like those in audio networks, and provides nearly instantaneous results when you tweak audio parameters in a network. Since even a short audio clip can use over a megabyte of storage, storing and processing only the necessary fraction of the clip reduces the memory requirements significantly, especially in large CHOP networks.
Time Sliced CHOPs do not maintain any more history about the channel than is needed, and they recook every frame. This makes them well suited to realtime applications. Even so, they can be used to "perform" and record an animation, instead of keyframing it.
- 1 How Time Slicing Works
- 2 Interface
- 3 CHOPs that are Always Time Sliced
- 4 CHOPs which are Occasionally Time Sliced
- 5 Null CHOP Can Stop Overcooking
- 6 Time Slice Options Dialog
- 7 Uses for Time Slicing
How Time Slicing Works
Time Sliced CHOPs cook whenever the Timeline is moved forward. The amount of time that the Timeline jumps ahead is the size of the current Time Slice. The Time Slice is synchronized with the Timeline so that its first sample begins just after the previous Time Slice's last sample, and its last sample is at the current frame. If the Timeline is playing forwards, the Time Slices generated will never overlap, nor will there be any gaps between them. All Time Sliced CHOPs will have the same Time Slice interval for a given cook.
When the CHOP network needs to cook, the Time Slice interval is computed and a single Time Slice is passed through the network. Since the current frame is always contained within the slice, the slice can be easily exported to any parameter.
CHOP Parameter Dialog - The Time Slice button is located in the Common page of the parameter dialog of all CHOPs. This button is greyed-out for CHOPs that do not have Time Slice capability, and for some CHOPs which always operate in Time Slice mode.
Edit -> Preferences -> CHOPs Dialog - The Time Slice options can be changed using this dialog. They can also be changed from the Textport, using the timeslice Command.
CHOPs that are Always Time Sliced
Most CHOPs do not need Time Slice capability; they will work on time sliced input in the same manner that they would on normal channel data. Time Sliced CHOPs and non-Time Sliced CHOPs can be mixed within the same CHOP network. The Time Slice option is provided for CHOPs that perform operations that read or modify other samples in the channel other than the current sample, or that maintain internal states.
Generally, if you want to create a time sliced CHOP network, all CHOPs with Time Slice capability should have their Time Slice flags (located on their Common page) on.
CHOPs which are Occasionally Time Sliced
The following CHOPs will output Time Slices under certain conditions, but are not considered Time Sliced CHOPs. The Time Slice button in the Common page is greyed out for these CHOPs.
Trim CHOP - The Trim CHOP can trim the current time slice out of any input CHOP. This function is selected by changing the Unit Values menu to Current Time Slice.
Record CHOP - This CHOP can be used to record the output of a Time Sliced CHOP over the animation range. It can also be used to interpolate a Time Slice from a CHOP that outputs a single frame (like the Mouse or Keyboard CHOPs). The input can be sampled over the entire Time Slice, or only at the current frame using the Record Input parameter. The output range can be selected using the Record Output parameter.
Null CHOP Can Stop Overcooking
See the Null CHOP Cook Type -> Selective option.
Time Slice Options Dialog
There are three Time Slice options, which can be changed using the Edit -> Preferences -> CHOPs dialog. This dialog is found in the menu.
Enable Time Slice Flag When Creating CHOP - All CHOPs with Time Slice capability created while this option is on will have their Time Slice flags enabled by default. Otherwise, all CHOPs are created with the Time Slice flag turned off. This is a convenient option to leave on when creating and working with large Time Sliced networks. This option is off by default.
Minimal Realtime Cooks - Some Time Sliced CHOPs can minimize their cooking, rather than cooking every frame. When cooking is unnecessary, or it produces the same output, these CHOPs will stop cooking until an input changes. CHOPs that have this feature are:
Minimal Cooking will not apply to these Time Sliced CHOPs if they have non-constant CHOP inputs or time dependent CHOP inputs. This option is Off by default. It can speed up CHOP networks that respond to isolated inputs or events.
Maximum Time Slice Size (frames) - This option allows you to limit the size of a Time Slice, expressed in frames. The default maximum is 6 frames. This is useful if you only need a few frames of history, and the Timeline is jumping ahead by large intervals. If a Time Slice is larger than this maximum size, it will be clipped from the current frame backwards (causing a gap between this slice and the previous one). The slice will always end on the current frame.
Uses for Time Slicing
Realtime Puppeteering and Control
Time Slicing speeds up the animation response to user input. It provides you with a variety of effects to layer onto the input, such as lag, springs, and filtering. It is otherwise more difficult to achieve these effects on realtime input.
Sometimes an animation is much easier to perform with an input device than it is to keyframe or produce using CHOPs. The input can be recorded with a Record CHOP and locked. This data can then be manipulated with CHOPs, or performed again as needed.
Realtime Audio Processing
The performance increase of Time Sliced audio processing versus normal audio processing is quite significant. With Time Slicing, it is possible to process realtime audio input and use the data to control animations. You can also do the opposite - use features of the animation to control audio output. Without Time Slicing, it is difficult to set up a network to do these actions in realtime.
General Audio Processing
Time Slicing allows you to clean up or add effects to audio files more efficiently. You can turn all the Time Slice capable CHOPs on and manipulate the audio while playing it, getting realtime results. When you are satisfied with the new audio, the Time Sliced CHOPs are turned off and the final audio clip is generated for the full range. This allows much more rapid tweaking of parameters to produce a desired effect.