Hey y’all, intermediate TD user who is coming from a Processing background here. I’ve been loving the power of TD and it’s ease-of-use, but one thing that I haven’t quite figured out how to do that I miss from my Processing days is the ability to create objects with a “lifespan” and manage these objects neatly in an ArrayList. I’ve been experimenting on my own and poking around the Forum here, but it turns out if you search “oop” you mostly get every thread where someone has typed “oops”
One technique I used frequently was to have a Processing sketch respond to incoming OSC messages (from MIDI or Antescofo~), instantiating a new object and adding it to an ArrayList each time a note is played. The object contained its own variable governing its lifespan, and it would be removed from the ArrayList once the condition for expiration was met.
The project I am working on now in TD attempts to simulate this approach using a Base as the “object” and a Replicator as the “ArrayList”. I have TDAbleton set up to respond to incoming MIDI notes that append a row to a Template Table that I am using to control a Replicator. So far, using the onReplicate function in the replicator callbacks DAT, I have been able to successfully create new Replicants of a simple Base containing a short animation that initializes and begins playing when created. The animation is driven by a Timer CHOP, so when the Timer done channel goes to one I use a CHOP execute that deletes the row that the Replicant was created from, but this creates all kinds of strange glitches… If I only append one row at a time, allowing the animation to finish, everything works as expected. But if I start playing more notes and appending more rows, sometimes the removal doesn’t work depending on the index position of the replicant. It seems like whenever I delete one row the index position may not update fast enough or get lost somewhere? Also visually some of the Replicants that are currently playing through their animations glitch out and end early whenever the Template Table is being altered. Does the onReplicate function run every time there is a change made to the Template Table? Does anyone have any advice or resources you can point me to for more neatly managing the Template Table? Or is this just a bad way to approach this kind of thing in TD?
After spending a few days experimenting, I am planning tonight to take an alternate approach where I have a static number of replicants. MIDI notes will trigger a script to check and see whether a replicant is busy playing its animation, and either start that one or move on to another. This will more than likely get me the effect I’m after, but it comes with its own set of tradeoffs. Anyway, just wondering if anybody else has tried to do something like this before and how you addressed it.
Thanks,
julz