Sequences with delay in Python

Hello, I am trying to create a procedural sequence upon clicking a button. First I play the audio, then wait a bit, then set a constant value to start an animation. This example is over simplified (would have many more steps to execute), but shows what I am trying to do. Python time.sleep doesn’t work because it stops cooking entirely. What would be the best approach?

timing.toe (5.0 KB)

It looks like if I use run everything works. Still not sure this is the correct approach.

op(‘audiofilein1’).par.reloadpulse.pulse()
run(“op(‘constant1’).par.value0 = 0.0 if op(‘constant1’).par.value0 == 0.4 else 0.4”, delayMilliSeconds=2000)

Run works, or you can look setting up a task with TDAsyncIO.

1 Like