Sound component terminates with file, not stated duration

Psychopy 1.84.2 on Win7 and XP.

Hello all,

I have a loop consisting only of a sound component. The duration is specified (5.0 seconds), but in spite of this, the component, and therefore the loop, is terminating at the end of the sound file instead. I’m doing this in the GUI, but here is the relevant code:

------Prepare to start Routine “trial”-------

t = 0
trialClock.reset()  # clock
frameN = -1
continueRoutine = True
routineTimer.add(5.000000)
# update component parameters for each repeat
sound_1.setSound(Sound, secs=5.0)

Does anyone know what could be causing this? Thanks.

Interesting. Looking further in the generated code, it seems like the duration of the sound file might take precedence over the specified duration (if it is shorter than that duration) and cause the routine to end prematurely.

You could insert another invisible stimulus (e.g. a text stimulus containing just a space character) with a specified duration of 5 s to get around this.