[solved] Code to exit the loop after defined time
Hi, I recently started using OpenSesame. I am using OpenSesame 2.94
I am trying to design a simple experiment where a sound clip plays for certain duration (say 10 sec) and while the sound is being played participants are suppose to see a series of visual stimuli.
I tried using the sampler and it plays the clip, and i present the visual stimuli using a loop but i want the loop to break as soon as the sound clip stops..Can anyone suggest me how to break the loop based on specified time using inline script ?
Comments
Hi,
You can keep track of time, while being in a loop.
The way to do that, is to first indicate a start time right before you enter the loop, by means of
start_time = self.time().Of course you also need to know the duration of your sound stimulus. Let's call the duration
duration. Your loop would look something like this:Does this make sense?
Cheers,
Josh
Thanks a lot Josh !
Also you can use the sampler function "is_playing".
This is an example of and old experiment that used that : ) Hope It will help to you!