| Reference | Downloads | Github

Online timing: frames or time in seconds?

I’m planning an online study that manipulates the SOA between two visual stimuli. The SOAs will likely include values of 0 to 500 ms (in steps of 100 ms). Is there currently a preferred method to achieve the most accurate timing for SOAs in this range online? (Assuming for now that the SOAs are all multiples of the time it takes to refresh the screen.)

I noticed that the timing mega-study used frames, but it seems the reason for this is not made explicit (unless I missed it).

Here is a related thread (which however focuses on issues related to presentation times that are not multiples of the refresh rate).


I would recommend using frames for short durations, whether online or locally but these times is sort of at the borderline where I would get tempted to switch so I think it’s a coin-toss on this occasion. Let me just spell out the logic and let you decide.

In short, using time increases the chance of being out by a single frame (important for short stimuli) but limits that error to being out by only a single frame (important for longer duration stimuli if the computer might not be keeping up).

Longer version:

Why select frames for short durations? Using time instead of frame counts means that psychopy/js has to guess at each point in time whether it should try to squeeze in one more frame of stimulus presentation. That decision isn’t as straightforward as you would think. e.g. if the decision is being made with 5 ms left before the frame deadline should we risk it? Using frame counts makes that decision more straightforward and reduces the chances of over/undershooting by a frame. If you have very brief stimulus durations overshooting by a single frame could be a big deal. Timing would overshoot if frames are being dropped but the chances of this a smaller if stimuli are only short.

Why select time for longer times? For longer stimulus durations, the chance of being out by a single frame is not likely to be such a big deal, but the chance of occasional dropped frames starts to increase the longer your stimulus is on screen (depending on the power of the computer and the complexity of the stimuli but let’s say online that can’t be trusted). If you present a stimulus for 1000 frames and you drop 1% of frames you might now be out by 167ms and that’s become an issue. Using time has the advantage that, if frames are being dropped they won’t impact the final time of offset because the only issue there is the decision time at the final frame.

Hope that helps


Thanks, @jon! I That is helpful. Given that there are good reasons to go for either approach, I’ll probably opt for time in this instance. This has the additional advantage that I wouldn’t have to check the frame rate of the monitor and adjust the number of frames if the participant uses a monitor with a frame rate that differs from 60 Hz.