OS: Win 11 PsychoPy version : 2022.2.4 Standard Standalone? (y/n) If not then what?: Y
Hi,
I am new to PsychoPy. I am creating an experiment in which participants will have to complete three different routines while simultaneously listening to either music or silence in the form of audio files. Between each task, participants will have to read a set instructions before they are prompted to proceed.
There are three subtasks in each task, each 2.5min long with a 30s break afterwards. For each subtask, participants will listen to “Silence”, “Music Type 1” and “Music Type 2”, once for each of the three subtasks and in random order.
Within each “Music Type” are three different audio files to be randomised. I have also made a silent audio file for “Silence”. Hence, I have a total of six 2.5min long audio files and one silent file(repeated three times in total) for nine subtasks. Each audio file is to play only once in the entire experiment.
I have already created the tasks. Now, what I want to achieve is to have one audio file of each type to simultaneously play in the background of each 2.5min long subtask and this to be done for all three main tasks. Do I first make a separate routine which is looped to randomise the audio files within each type and then a loop surrounding it to randomise the three types? If so, what code can be used in this routine for it to simultaneously play with the tasks routines?
Thank you so much for the help, the audio is playing well. However, since each subtask includes multiple stimuli within a loop, when I insert the code into the routine within the loop, the audio will play for its entire duration before moving onto the next stimuli in this loop.
Is there a way where each file can play through the multiple iterations of each loop. Thanks!
After that, you can use background_audio.play() and background_audio.stop() at any point in your experiment to start and stop the audio. It will play across multiple routines or repeats of a loop without a problem.
Make sure to select the ptb audio backend in the experiment settings!