Fixing sound delay and jitter in psychopy coder (windows + PTB)

Hi,

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?

Best wishes,

Ladislas

1 Like

Hi, I am currently facing the same issue. Could should share more detail on how you set up the trigger und whether you used the GUI or “pure” code?

Best,

Tim

Hello @Tim_Dressler

Have a look here to find out about variance and delay of audio stimuli.

Note that you can only replicate the results with the same setup. A different sound card will most likely give you different results.

Best wishes Jens

Hello Jens,

Thanks for your reply! I know that an exact replication is not possible on different machinery, however, I currently face the issue that my sound onsets jitter a lot (-20ms to +30ms lag, relative to a parallel port eeg marker). Other lab member achieve 19ms lag with basically no jitter in NBS Presentation. I am pretty much stuck, having tried all combinations of settings (similar to Inability to have precise timing for auditory stimuli), even in barebone experiments with only and audio stimulus and the marker. Do you have an idea? Best,
Tim

Hello @Tim_Dressler

I am sorry but I don‘t have an idea how to achieve a better timing on your machine with PsychoPy. I guess I would switch to Presentation given that it is installed on your machine. I remember that I took me some experimentation and a new sound card to get proper timing with a sound card on our PC running Presentation.

The tables in the article show that Presentation does a pretty good job presenting sound, better that PsychoPy on Win10 machine. What you could try is to install a dual-system on our lab-PC, install Ubuntu and run the experiment from there.

Best wishes Jens

Hi Jens,

Thank you for your replies!

Best,

Tim