Unintended “sped up” timing for sound stimuli

OS: Windows 10, 64-bit
PsychoPy version: v2023.2.3 (Standard Standalone)

What are you trying to achieve?:
Hi everyone,

I’m building an experiment in which a soundtrack is played during a block of trials. The duration of all the routines in that loop adds up to 90 sec, which is the same duration of the audio file that is supposed to be— synchronously—playing along with the presentation of the visual stimuli.

I’m calling in the soundtrack (a .wav file) in a routine component that displays a no-text screen. And since participants are exposed to the sound for 5 secs before seeing visual stimuli, the duration of this routine is specified as 5 secs. As per documentation, I have also “untick” the “stop with routine” option of the component, to let it play for its duration beyond that routine.

What is wrong?:
The problem that I’m having is that, at times it seems, the audio file finishes earlier than its duration. After testing and trying with non-experimental tones (i.e., songs), I realised that the music sounds as though it is being played at x5 or so the normal rate.

The puzzling thing is that, according to the data log., the audio files supposedly played for the right duration (i.e., 90 secs), but in fact the “sped up noise” is only heard for 5 or 30 secs—timed independently.

I have had the audio files looked at by sound engineers and they didn’t find anything that could be wrong with the audio files themselves.

Has anyone encounter an issue with this? Is there anything that I can try to solve this? I very much appreciate any advice on this :wink:

It turns out that the files that I was using for testing were at 48000Hz, whereas the experimental stimuli were at only 16000Hz. In hindsight it then became obvious that the speed at which the audio was being read was correlated to the sampling rate of the file.

The simpler solution therefore was to tell the library what values to expect (in my case 16000Hz). Easy to address from a coder point of view, but I’m including an image here of how I integrated that into the code component of the experiment builder, in case somebody find themselves in a similar conundrum in the future.

2 Likes