| Reference | Downloads | Github

Sounds are displayed with an irregular delay

Hi everyone,

I’m using PsychoPy to prepare an oddball paradigm in which I preset a picture on the screen for 7 seconds and during the picture presentation 14 consecutive sounds are displayed every half a second. For every sound onset I send a trigger to the parallel port. I then ran timing tests to see whether the sounds are played at the same time as the triggers.

While the triggers seem to be fine and arrive every half a second, this is not the case for the sounds. The sounds are played with a delay of 100ms-200ms after the trigger and the difference between consecutive sounds’ onsets is not half a second. The size of the sound file doesn’t make a difference and the delays seem to be the case both for very short sounds (10ms) and longer ones (250ms). I tried to add ISI at the very beginning of each trial and load both a picture and the sounds during that period but it didn’t help.

I also tried to add the ISI before every sound and load the sounds during these shorts ISIs but it didn’t help either. Do you have any idea how the problem could be solved? Is there any way ISI could help? Am I supposed to have one ISI at the beginning of the trial to load all the stimuli for that trial or multiple ISIs per trial, one per stimulus?

I’d appreciate your help very much. By the way, the delay for the visual stimulus (i.e. the picture) is small and constant across trials.

Best wishes,

Hi @Karolina, recently we ran some sound latency tests with PsychoPy 2 and report some ways of improving sound latency using Pyo and ASIO drivers. Here is the link. Give this a go and see whether you sound latencies improve. Also, with the latest download, you can sync your sound onset with the screen refresh using the callOnFlip call or selecting “sync with screen” (which is selected by default in the sound component".

Thank you for this suggestion! I tried to use pyo library instead of pygame and it helped a bit but did not solve the problem entirely. First of all, the delays are still large (over 200ms) but now they are less variable. Another problem is that if I use the 1.85.2 version of PsychoPy and the pyo library, it won’t display any images or text, just sounds. Every time I try to add any visual stimulus even as simple as one word, the screen would freeze (I won’t even get an error message). Do you have any idea why it could be? It seems to work ok with an older version of PsychoPy (1.82.01).

@Karolina, just checking, did you install the ASIO drivers?

ASIO is listed as a n audio driver in PsychoPy Preferences so I assume this is what’s being used.

That is the order in which PsychoPy looks for drivers, but to make sure you have the driver you should go to then download and install the ASIO driver. Then, change the order of the drivers in Psychopy preferences so that ASIO comes first, otherwise “Primary Sound” will be used. Without the driver, the latencies with Pyo did not improve in my tests.