Play Sound Delay

I’ve been doing an audiovisual experiment,but I found the stimuli of sound had 100ms delay,it’s mean that Visual and auditory stimuli were asynchronous,I want to sound was forward play to keep synchronous,now I have no idea.

sound_file = ‘didi.wav’
mySound = sound.Sound(sound_file)

I used the code to play sound on Begin Experiment.

What I do to control sound files online, which might work for you, is to first play them with zero volume and then use mySound.setVol(1) and mySound.play() to start the sound when I want it, so a new sound object doesn’t need to be created at the time.

mySound.play was in Begin Experiment,When my stimuli present,I use
nextFlip = win.getFutureFlipTime(clock=‘ptb’)
mySound.play(when=nextFlip)
But,it didn’t seems make any difference,so I want to use some functions to achieve sound forward.
I can’t figure it out right now.

Why not put it in Begin Routine?