| Reference | Downloads | Github

Many sound stimuli throughout the movie clip

Hi! I added a movie clip which lasts around 23 minutes. In my experiment I use a secondary task technique, that is apart from watching a movie my participants have to press ‘space’ whenever they hear a sound. The sound has to occur 5 times per minute. I know how to add a sound but I have to do this 115 times. Since I have 9 such clips to prepare, I was wondering whether there’s a quicker way to do this - is it possible to insert a sound and tell PsychoPy to play the sound 115 times either in equal intervals or randomly?

Whenever you think about repeating something many times in a programming context, it is the wrong approach to take. In this case, you just want a single sound component and a loop so that it plays 115 times. What this means is that the movie needs to be created in code so that it plays in the background continuously, without being part of the discrete routines-within-a-loop structure.

See this post here, which oddly enough is about the opposite approach (playing a sound in the background instead of a movie):

As in that post, create your movie at the beginning of the experiment, but instead of code in the “begin routine” tab, put this in the “every frame” tab: