psychopy.org | Reference | Downloads | Github

Scheduling a sound with psychtoolbox

Hello everyone,

how much time should I minimally leave between scheduling a sound and playing it to still reap the benefits of scheduling the sound? E.g. in the example below, the sound is played after 0.5s. Is this enough? Or could I even go below that?

from psychopy import prefs
import psychtoolbox as ptb
prefs.hardware['audioLib'] = 'ptb'
prefs.hardware['audioLatencyMode'] = '4'
from psychopy import sound

mySound = sound.Sound('A')
now = ptb.GetSecs()
mySound.play(when=now+0.5)  # play in EXACTLY 0.5s

(I’m using Psychopy v3.2.3.)

On windows (this will be machine specific) my casual tests suggest that roughly 15ms is needed so 0.5s should be plenty. But if this really matters to your study you should test on your machine using a mic/oscilloscope etc. It will be very dependent on hardware and other OS settings