We are trying to schedule a visual stimulus for a set time after we
begin audio capture for an experiment. Because
PsychPortAudio('Start') doesn't allow you to schedule the start of
audio capture, we scheduled the visual stimulus to appear at a set
time after the reported start time of audio capture.
We used the 'when' argument in Screen('Flip') to do this, but we noticed a variable discrepancy between the start of recording and visual stimulus presentation as defined by the output arguments to Screen('Flip'). We made a simpler script to examine this issue further. This script presents visual stimuli by getting the current time and scheduling a flip for 100ms later using the 'when' argument to Screen('Flip'), with some jitter added between stimuli:
https://gist.github.com/carrien/bd4bdf15904120f22f541e9e4a5da70f#file-run_fliptest-m-L27-L29
(Relevant lines highlighted)
The returned stimulus time, whether measured by VBLtimestamp, StimulusOnsetTime, or FlipTimeStamp, was off from the 'when' argument by up to 16.8 ms (see attached figure, which was generated by the above script).
Probably not coincidentally, this is the same refresh interval
measured by Screen('GetFlipInterval').
How do we get around the delays introduced by the refresh rate interval? We want to be able to schedule the visual stimulus for a fixed delay after the start of audio capture (which PsychPortAudio('Start') does not allow precise control of in pure capture mode).
We're running this using MATLAB v. R2015b on Ubuntu 14.04 LTS, with these properties:
Memory: 3.7 GiB
Processor: Intel® Core™ i5-2540M CPU @ 2.60GHz × 4
Graphics: Intel® Sandybridge Mobile
OS type: 64-bit
The output of PsychtoolboxVersion is:
3.0.12 - Flavor: Debian package - psychtoolbox-3 (3.0.12.20160126.dfsg1-1~nd14.04+1)
Thanks for any help you can provide!
Ian & Carrie