Hello Chris.
I have realized that nextFrameTime() - now() gives about 0.2ms jitter. I assume this is about the error of next frame time estimate. Is there a function giving the actual time of updated display?
Thanks!
-Jing
Hello Chris.
I have realized that nextFrameTime() - now() gives about 0.2ms jitter. I assume this is about the error of next frame time estimate. Is there a function giving the actual time of updated display?
Thanks!
-Jing
Hi Jing,
The now
function just returns the current time. It isn’t tied to the display refresh cycle, so there’s no reason to expect a constant delta between the values returned by it and nextFrameTime
.
Are you trying to determine when the current frame was displayed? If so, the best available estimate would be
nextFrameTime() - 10e6 / refreshRate()
Cheers,
Chris
I try to copy a digital output while updating the stimulus on display (by put a DO channel to high before the action “update display”). I want to know exact time delay between the DO assigned and next frame shown. I found they are 15.5ms with 0.2ms jitter. I guess my question should be What’s the best way to have output synchronized with monitor refresh? we’d like to register/ trigger some events in physiology which requires ms resolution.
Thanks!
Hi Jing,
What’s the best way to have output synchronized with monitor refresh?
At present, I think your best option is the following:
nextFrameTime
now() >= stored_next_frame_time
This isn’t ideal, because it’s possible (though not likely) that there will be sufficient delay between steps 1 and 2 that nextFrameTime
will return the time of the frame after the one you want to synchronize with. To make this more robust, we could modify “update_stimulus_display” to store the correct next frame time in a variable.
Chris
Hi Jing & Evan,
To make this more robust, we could modify “update_stimulus_display” to store the correct next frame time in a variable.
This is done and in the MWorks nightly build. The “update_stimulus_display” action now accepts a new (optional) parameter, predicted_output_time
. If the value of this parameter is set to the name of a variable, then “update_stimulus_display” will store in that variable the predicted output time of the frame in which the update will take effect.
Here’s my new recommended method for synchronizing a digital output with a display refresh:
predicted_output_time
set to some_var
now() >= some_var
Cheers,
Chris