Setting the audio driver

Hi guys,

I want to minimize the delay of my auditory stimuli while working on fMRI tasks. Do you think setting the PTB to 3 is sufficient and necessary?

from psychopy import prefs
prefs.hardware[‘audioLib’] = [‘PTB’]
prefs.hardware[‘audioLatencyMode’] = 3

Thank you!

It’s hard to give a blanket yes or no; I expect it will reduce latency, but whether that reduction matters will depend on how low your latency already is and how low you need it to be.

What you can do is measure the latency using an Audio Validator Routine. Essentially:

  • Setup a sound sensor device in Device Manager (this could be a dedicated device like a Cedrus Riponda, BBTK T-Pad, etc. or you can use a microphone)
  • Make sure the device is in range of the speaker you’re playing sounds from (one way to do this is to use an audio splitter to plug the same audio cable going to your speaker directly into the microphone socket on your device/computer)
  • Create an Audio Validator Routine in your experiment and select the device you setup
  • In your Sound Component, under Testing, choose that validator Routine in the “Validate with…” drop down

Your experiment should now have, in addition to the usual mySound.started/stopped columns, columns for mySound.myValidator.started/stopped and mySound.myValidator.startDelay/stopDelay, which tell you the difference between when PsychoPy requested a sound to play and when your sensor detected the sound playing.

By looking at the difference in startDelay when running in latency mode 2 vs mode 3, you can make an informed decision on whether latency mode 3 is worth it for your study.

Thank you so much! I will try to implement the validator