Playing a repeating sound in a random time interval

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): v2021.2.3
Standard Standalone? (y/n) If not then what?:y
What are you trying to achieve?: I am trying to run a test that shows a series of videos (loaded from disk) and along with the videos have a sound playing that is triggered every 1-1.5 seconds and lasts around 0.7 seconds.

What did you try to make it work?: I’ve created a Flow with all the videos loaded in different routines, the videos are displaying correctly. But for the sound i did a python script that uses winsound.beep() to trigger the beeping sound. I try running this method using

  • multiprocessing
  • threading

What specifically went wrong when you tried that?:
for the first the flow didn’t even display correctly, just freezes on loading and crashes soon after. When using threading the flow is started but the videos are been display at 1-2 fps and skipping all the missing frames.

So basically thats what i’m trying to do. play a beeping sound along side the videos that triggers in a random time between 1-1.5 seconds? any ideas that could help me? much appreciated.

Include pasted full error message if possible. “That didn’t work” is not enough information.

Hi There,

Perhaps this solution might help? Presenting stimuli and randomising interstimulus interval for a duration of 40 seconds - #2 by Becca

1 Like

Thank you so much!

Hi Becca,

I’m trying to use your solution to present an auditory stimulus with an interstimulus interval that varies randomly between 8 and 10 seconds.

I’ll leave the code and the builder here:



The problem is that the stimulus is delivered within a time range different from the interstimulus interval selected. For example, the first stimulus is delivered 18 sec after the beginning and the second stimulus at 20 sec (2 sec after the first stimulus).

Thank you in advance for your help!

Marta