With this approach there will inevitably be some latency in the output, determine by the execution time of your loop. The smaller you need the jitter to be, the shorter the loop execution time needs to be. You need to figure out how much jitter is acceptable, and what the maximum loop execution time is.