In case it can be helpful to others, I am sharing some feedback regarding trials and errors while trying to get audio stimuli synchronised with triggers on Windows (and using the PTB back-end).
In short: even when following the documentation’s recommendation on timing (e.g., presenting stimuli for a number of frames, presenting before logging etc), we had a 10-12ms delay between trigger and stimulus onset and a jitter of ~15-20ms amplitude.
What worked in the end was to change the “wait_for_start” argument in the audio.py script (from 0 to 1) directly in the psychtoolbox code (within the psychopy folder). In this way the code “waits” for the actual start of the audio stimulus before going to the next line.
It would probably be useful to allow users to set the value of the “wait_for_start” argument in the play() method of the PTB backend in psychopy?