Take a look at this thread for some ideas:
https://discourse.processing.org/t/is-it-possible-to-get-millisecond-accurate-renders-with-animated-processing-sketches/35604
Take a look at this thread for some ideas:
https://discourse.processing.org/t/is-it-possible-to-get-millisecond-accurate-renders-with-animated-processing-sketches/35604