If you time your animations based on the frameRate
variable, then it doesn’t matter how long it takes to render or save out each frame. Base your animations on a time variable computed from frameRate
such as
float t = frameRate/30.0;
and then save each frame at the end of draw()
. Processing will NOT drop any frames, they will simply lag behind the real-world clock.
External to Processing, you can then use ffmpeg (or whatever you prefer) to combine the frames into an animation along with your audio track.
Just be sure that you are using that same frameRate
-computed time variable for indexing into your audio track. You can’t use computed time for the animation but use wall-clock time for the audio and expect them to match up.