Latency issue between LSL markers/HW triggers and stimulus presentation

OS Win10
PsychoPy version 2023.1.3
Standard Standalone? Yes
What are you trying to achieve?

Hi everyone,

I have recently conducted some timing verification tests in our experimental setup, using the PsychoPy script in this tutorial (BCI+ | LSL Markers and/or Hardware Triggers with Brain Products and Stimulus Presentation Software) and BrainProducts devices (BrainAmp ExG 1000Hz, TriggerBox, photosensor). The script ran via PsychoPy Coder v2023.1.3 on Win10, while LSL recording was done through LabRecorder on Win7.

In the script, a square alternates between black and white every 30 frames (i.e., every half a second on a 60Hz monitor) for 500 trials. A hardware (HW) trigger and an LSL marker are sent whenever the square turns white (‘1’) or black (reset to ‘0’). The desired synchronization is for LSL markers and HW triggers to be sent concurrently with the rise of the photosensor (PS) signal.

What did you try to make it work?

When analyzing the data, the latency between LSL markers and HW triggers is consistent at ~55ms, as expected with BrainAmp. The notable issue lies in the variable latency between LSL markers/HW triggers and PS events, displaying a sawtooth pattern. The latency between LSL markers and PS events is particularly high, averaging ~91-93ms with peaks reaching 120ms.


I have tried both a 60Hz dual monitor setup (Test 09) and 144Hz dual monitor setup (Test 12). If anything, the higher refresh rate setup resulted in even higher latency.

Does anybody have insights on the potential source of this latency issue?
Could it be due to dropped frames (although 90ms worth of dropped frames in a 144Hz monitor seems improbable) or to some graphics card option, such as triple buffering?

Thank you in advance for the help.