I have a project where a series of audio files are loaded dynamically from a folder. For each audio file there is an associated lighting sequence that is played back in sync. So far I’ve been doing this with an Animation COMP whose clock is driven by the Audiofilein CHOP’s fraction. Works great, tracks perfectly, fully editable, wonderful!
Now what if I need 20? I first tried generating as many Animation COMPs as there are audio files in the folder but this immediately slows down TD to a crawl. Two questions:
- Is there a way to have only a single Animation COMP and dynamically load its channel and keyframe content from previously stored files? I guess I could do it programmatically from scratch using the Animation COMP class’s setKeyframe() and deletKeyframe() methods but I’m not sure how I can extract the keyframe info in order to store it in the first place.
- Another option is to indeed create a bunch of Animation COMPs but to only allow one to cook at any given time. Less work, less elegant, more memory, more clutter… Any thoughts on this method?
First we need to identify what part of scaling to 20 is the slowdown. Is it the AudioFileIns, the Animation COMPs, or the stuff downstream that the Animation COMPs are driving. I wouldn’t expect 20 AudioFileIn indexes just driving Animation COMPs to be a slowdown, so I am wondering what is cooking downstream?
Thanks for your reply.
The structure goes like this: For each folder containing WAV files I have a base object containing a single Audiofilein fed from a folder DAT. All files in a given folder are played in sequence or randomly. Associated to each row in the Folder DAT there is an Animation COMP. I would have preferred to have a single Animation COMP who’s content gets replaced dynamically depending on which audio file is playing but this doesn’t seem possible or at least not simply. So, for now, I have a bunch of animation comps standing by with their allowCooking set to false and each time a new audio file is loaded I switch the associated Animation COMP’s allowCooking to true. This works and my fps remains at a steady 60 but if I leave more than 2 or 3 Animations COMPs cooking simultaneously it drops very quickly as can be seen here.
I noticed that it appears to be the number of channels inside each Animation COMP that is causing the slow down and not the number of keyframes. When I add multiple Animation COMPs with no or very few channels defined my system doesn’t get bogged down. Currently I need 24 channels per animation (6 DMX fixtures with 4 channels each).
Any thoughts are welcome and if you know of any way of dumping the contents of an Animation COMP into a table or as JSON that would make my day
Maybe you could sent you project zipped up to support so we could work with it as an example. It sounds like this needs some optimization on our end.
I’ll see if I can simplify it down to the minimum requirements in order to repeat the issue and send it over to you.
Have you tried the full range mode, outputting the whole animation as a CHOP that can then be fed in a lookup and a timer instead?
I have not.
I gather this means the Animation comp is then static and maybe doesn’t use up as much resources while sitting idle?
If so that is interesting!
I’ll give that a try
Indeed, it will only cook once creating the data and thats it. I suppose this is basicly a classic tradeoff from memory<->speed, but should not be that big of an issue. From what I gathered is that the annimation comp might actually be calculating the values on the fly compared to just doing a dumb lookup. (But that is just a guess.)
Yup! much better when used in full range mode (around 1ms per animation comp):
compared to the use input index mode (roughly 6ms per animation comp):
And I believe the times shown in the full range mode only apply to redrawing the components within the network which won’t happen once I run in perform mode.
Wonderful, thanks a lot Wieland!
You can also just deactivate the viewer with the button top left of the op
That 1ms in full range mode should be 0ms in Perform Mode or when the viewers are off because the Animation COMP will not cook when it doesn’t need to display the viewer. So, if you are monitoring performance try either of those things, that 1ms is not needed.
Any thoughts are welcome and if you know of any way of dumping the contents of an Animation COMP into a table or as JSON that would make my day ..
I later realized upon navigating down into the Animation COMP that it already contains four tables named channels, keys, graph and attributes which I believe contain all the information required to build your own save/retrieve mechanisms.
I haven’t done it yet but it seems feasible.