Parallel loops
in OpenSesame
Hello guys,
I'm new to OpenSesame.
In an experiment I want to show pictures and play sounds in parallel.
An example:
1. For 2 mins, every 20 seconds a picture should appear (different pictures).
2. With the same beginning, every 7 seconds a sound should be played (every sound is different).
Each of these tasks in easy for me to implement in OpenSesame (loops with sketchpads/sampler) but the problem is how to do these two tasks in parallel.
Is there any solution with the Coroutine item? I tried it with loops but they are not available in Coroutines.
I hope you guys understand what my problem is ![]()
Thanks for the help.
Comments
Hi Flippy,
I don't know what your Python skills are, but I would solve this in
inline_scriptsaccessing the sound and canvas functions directly. However, you can also consider trying to implement it with co-routines. They were designed to allow for parallel things to happen. I've never used them, so I can't help you much there. Sorry.Btw. Based on your description, you don't necessarily need parallelism. The tricky bit is to initialise the
sketchpadandsoundsat the right moment, which requires you have to access to the presentation at any time, but not necessarily access to both at the same time. ( At least I believe so).eduard
Eduard
Hi eduard,
thank you for your help. I'm a total beginner in Python and OpenSesame. Can you show me how accessing the sound and canvas functions in parallel would look like in an inline_script?
Would be helpful for me
Hey,
To get started, you can check out the examples in the links that I provided. If I have some time later this week, I'll try to fix a little script for you.
Eduard
I need some more help with my script.
The two functions picture_show and sound_play should run in parallel.
When I call both functions individually everything works fine.
The problem appears when I try to call the functions in threads. The keylog implemented in the sound_play function isn't working properly anymore. How I said, when I call just the sound_play function, all works fine.
Do you have any idea why it isn't working with multithreading?
Here is my code: