Running experiment in the background while muted video is playing
in OpenSesame
Hi,
I'm running an experiment which involves playing a series of audio files and participants will sometimes need to press a button on the keyboard. I want to run my experiment while a muted video is playing instead of presenting a fixation dot when the audio plays. The video should play for the whole duration of the experiment with a break between 2 experimental blocks. I read that this cannot be done simply via the GUI so I was hoping someone could help me with what I should put as an inline script?
Thank you so much for all the replies so far! Open Sesame is great, but a steep learning curve for me :')
Comments
Hi @shaza
I'm not entirely sure what you're trying to achieve just yet; could you share a sample of your experiment, or at least describe the design in a bit more detail?
When you say the muted video should play for the whole duration of the experiment, do you mean it should keep playing in the background even during breaks and between trials? Or just loop between audio trials/restart at the end of a trial? What’s the overall structure of your experiment and the structure of each trial? Are all the audio files the same duration as the muted video?
With a bit more info, I’ll be happy to help you figure out a solution!
Best,
Claire
Check out SigmundAI.eu for our OpenSesame AI assistant! 🤖
Hi @cvanbuck
My experiment consists of 120 target trials where audio sentences play one after another. An auditory catch trial appears once after every 20 target trials and participants have to make a keyboard response (space bar). This is then followed by an auditory filler trial (no response needed). The first block would have [20 target trials > 1 catch trial > 1 filler trial] for 6 times, followed by a break (with number of keyboard presses as feedback), and then another block that's the same as the first block. All sentences are unique so they have different durations. The keyboard response times out around 3 seconds after the catch trial starts.
We're planning on showing a video that plays during the trials and paused during the break + feedback and resume when the next block starts. Basically just something they can watch while they perform the experiment but it has to be muted so they can hear the experiment. If it's not possible to pause a long video during the break, we're also open to having two separate videos playing during the first and second block.
Thanks :)
Shaza
So I noticed that coroutines can run some items simultaneously, but it doesn't work for loops and the media player unfortunately. Could it perhaps be done using something similar?
Hi @shaza,
I gave it a try using the experiment template you shared earlier, as I’m assuming this is the one where you want to have the video playing in the background.
To make it work, you just need to insert the path to your video file in the Prepare phase of the play_video_script inline script (see the screenshot below).
You can also adjust other parameters as needed, but this setup is the best I was able to get working for now.
Hope it helps!
Claire
Check out SigmundAI.eu for our OpenSesame AI assistant! 🤖
Thanks @cvanbuck,
May I know which version of Open Sesame and numpy you're using? I tried to run the experiment but I didn't have OpenCV (error message: "The specified module could not be found") so I tried installing it via pip, except that pip wants to upgrade my numpy from to 2.2.6 and this was incompatible with some existing python packages. I saw on their website that they require Python to be downloaded separately, but since OpenSesame has an inbuilt python package, will there be a clash?
Shaza
Also, I noticed that you changed the backend from xpyriment backend to pygame - will this change affect my experiment? Does cv2 only run on pygame?
Hi,
I managed to import cv2 without pip installing an updated numpy by installing an older version of opencv-python through:
pip install==4.7.0.72The video plays, but now I have a problem where the video pauses after one trial, although I'm suspecting it might be because of somewhere else in the experiment. I'm using the parallel_port_trigger plugin and also an inline code to delay this trigger.