Looking for more detailed instructions on accurate timing

I am looking for more information on how the accurate timing works in Psychtoolbox.

I have the following code:

slack = Screen('GetFlipInterval', mainWin)/2;
IFI = Screen('GetFlipInterval', mainWin);
Screen( 'flip', mainWin, (30 * IFI) - slack, 0 )

and I don’t understand what the parameters in the Screen( ‘flip’) function are for. I know that IFI is returning an estimated monitor flip interval but I don’t know what the purpose of the slack variable is and 30 is suppose to be the SOA but I don’t know how this all gets converted to a millisecond or second value. If I wanted to alternate two images on the display for 560ms each until a 60 second time limit is reached or the participant presses a key on the keyboard for example, how would I code for 560ms or 60s?

Another example is this while loop:

while GetSecs - TgtWinTime < (120 * IFI) - slack

According to the comment in the code the loop is suppose to end after “approximately 2000ms”. How is 2000ms calculated from this line of code and if it’s suppose to be accurate I don’t understand the approximate part.

I am looking for any resources to help me understand these questions. If this is something simple that could be explained in a comment I would appreciate that as well.

Thank you.

The poster in Psychtoolbo/PsychDocumentation/ECVP2010Poster_VisualTimingPrecision.pdf

and other pdf’s in that folder provide detailed infos about how visual timing works, even though they don’t cover the latest stuff or results after 2010, but will do as intro.

-mario

1 Like