Hi! I am very new to PsychoPy and I am stumped as to two specific (but interrelated) problems in organising the experiment I am compiling. I would be hugely grateful for some guidance!
Problem 1 – quasi-random presentation of stimuli:
I have five conditions (SynchronyTypes). Each SynchronyType has two associated speeds (‘Fast’ and ‘Slow’). I have 10 unique sound files, representing the Fast and Slow versions of each SynchronyType.
Each trial is broadly the same (in that a sound file is presented, then the participant responds to two questions). In selecting which sound file to play, I want the experiment to cycle through each of the five conditions/SynchronyTypes twice, giving 10 trials in total. Within each cycle, the order in which the SynchronyType is presented should be random (without replacement). In the first cycle, for each condition, the experiment should randomly select and present either the Fast or Slow variant (and play the associated sound file). In the second cycle, I want the experiment to select the Fast or Slow variant which was not selected in the first cycle, so that all 10 sound files are presented once.
Can I achieve this with loops/conditions files, or do I need to add some code? Previously I have just fudged the problem by generating ‘Order A’ and ‘Order B’ versions which meet these constraints but I would like to avoid this.
Problem 2:
I want each sound file to be presented as if they were made by a (different) child. So I want the experiment to randomly select one of 10 children to associate with each sound file/trial. In the course of each trial, I want to present an image of the child and the name of the child in the text.
This would obviously be straightforward to do if it were the only thing I wanted to vary from trial to trial, but I am unsure how to combine this with the above set up. When I built a previous version of the experiment in ePrime, I created a nested variable called ‘Pairs’ and put the names and images in a separate nested list, but am unsure how to achieve the same thing in PsychoPy.
Re: Problem 1: I can’t see a possibility to solve this without using code. Here is one option (there might be more elegant solutions which I can’t currently think of…):
Create a list of lists with all sound files:
soundsList = [["sound1_fast", "sound1_slow"], ["sound2_fast", "sound2_slow"], ["sound3_fast", "sound3_slow"]] # and so on
I haven’t had time to try this out yet (and I think it will take me some time to work through it!), but I just wanted to say thanks so much for your help and time with this, I really appreciate it. I will let you know how I get on.
I wanted to let you know how I solved this problem in the builder in the end, and also to ask for some help getting it online (see next post).
In getting this running in the builder, I used a lot of what you proposed but also simplified things a bit to save my sanity!
To solve (fudge) problem 1, I made two conditions files (Order A and Order B) for the trial loop, and used the Experiment Info box to direct participants to one or the other. So the sound files play sequentially in one of two set orders.
To solve problem 2 I inserted a code component before the trial loop with a list of dictionaries containing the children and their associated images and text. Then I shuffled this list. In the conditions file I added a column called “childNo” with numbers 0-9. For each trial, the image/sound component draws upon the dictionary and the conditions file e.g. the image of the child displayed at the start of each trial is set as people[$childNo][‘pic’].
So the end result is that the sound files are presented sequentially from trial to trial (in either Order A or Order B) and, since the order of items in the dictionary is randomly shuffled for each participant, the child associated with each sound file is set randomly every time.