As a minimal working example, I have a picture component (a speaker icon) and a sound component (WAV with no padding at the beginning) defined at the top of my Trial routine, both set to start at 0.
I’d expect these to start at exactly the same time, however there is always a lag of 1-second or so between when the picture appears and when the sound then starts playing. I don’t understand why this is happening.
I switched the order and moved the picture component at the top, with the sound component second, but things don’t change.
How can I remove this delay between the onset of the two components?
OS (e.g. Win10): Win10 PsychoPy version (e.g. 1.84.x): 3.1.0
It takes a finite amount of time to load a file (images or sound) from disk and then process it in order to be able to work with it. So if you need a sound file to start playing immediately at a specific time, particularly if it is a large file, you should pre-load it in advance of the required time.
This can be done by inserting a “static period” component that occurs at some point when nothing is really changing during your procedure (e.g. when a fixation point is being shown. Then, in a later sound component, you specify that the sound file is set during that specific named static period, rather than the usual “every routine” setting.
You might also be able to improve performance by ensuring that the sound file is no longer than it needs to be.
Thank you Michael. I was just surprised that the lag is so great (order of seconds, perhaps 1-2s) for a sound file that is only 10s in length and therefore should load quickly. Anyway, I’ll try the preloading solution.
I have the same problem as described here - a 1-2 second lag between an image and a sound. My sound files are only 1.25 seconds (single-channel, plays only to the left or right ear, one loaded per trial). I load the sound during a 3.5 second static period before the start of the sound, which doesn’t improve things.
As a test, I checked whether playing a uniform 1.25 second tone (“A” in the sound textbox, set to load on each trial) created the same problem; things worked fine in this case.