psychopy.org | Reference | Downloads | Github

PsychoPy 2 Sound Latency - an update

Hi everyone,

This is a quick report regarding sound latency for PsychoPy2. To prepare for the release of PsychoPy 3, we are setting up a series of tests to measure the latencies of PsychoPy. Regarding the sound latencies tested for PsychoPy 2, some interesting findings emerged that will benefit the PsychoPy community, especially those where sound latency is of upmost importance. In summary, you can vastly improve your sound latencies up to ~88ms by using the Pyo audio library and installing/using the ASIOForALL sound driver (http://www.asio4all.org/) – you can make these your default in your experiment settings dialog in Builder! We will soon be running the same test on Windows 10 to assess whether their audio latency changes improve performance for the default settings (i.e., sounddevice library with Primary Sound drivers).

Here’s what we did…

Procedure

We conducted a sound latency test using the Black Box Toolkit (BBTK) on a Windows 7 Desktop with Intel Xeon 3.7Ghz machine with 32gb RAM running PsychoPy 2. Across 500 trials for each audio library (Pyo with ASIO drivers vs. Sounddevice with default Primary Sound driver), the BBTK monitored for a TTL signal from a LabJack connected to a USB port, and the onset of a sound signal direct from the 3.5mm audio output jack, sent via PsychoPy from the PC. Both TTL and audio signals were set to trigger on the initial win flip at 300ms from trial onset, for a duration of 100ms.

The TTL signal received by the BBTK acts as the baseline condition for receiving data from PsychoPy, and thus all sound latencies are relative to the detection of the TTL pulse by the BBTK.

Results

The independent samples t-test revealed a significant latency difference between the Pyo and Sounddevice audio libraries, t(998) = 311.29, p < .001, where the mean latency for Pyo with ASIO driver (M = 22.61ms, SD = 3.39) was significantly faster than the mean latency for Sounddevice with default Primary Sound drivers (M = 110.26ms, SD = 5.31).

Figure 1. Histograms showing sound latency distributions for Pyo and Sounddevice audio devices. The silver dashed line shows mean latency (ms) and the red shaded area represents +/- 1 standard deviation.

4 Likes

I would like to understand the utility of this information.

the mean latency is a systematic error and can be accounted in the stimulus design. Using the sounddevice, I get exactly same results as presented above. However, the pyo does it perform any better?

only marginally in my opinion.
the mean latency is reduced. this is good, but this is still a systematic error which can be accounted in the stimulus design. The trouble is with the
jitter at stratup…

it is basically the same in the two situations…

is it possible to reduce the jitter to less than 1ms? that is the question

Thanks