OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2020.2.10
Standard Standalone
What are you trying to achieve?:
I am trying to build an experiment using Builder and am new to coding. (so I apologize if I’m missing something obvious !)
In this experiment, the subject has to click inside a round stimulus, which triggers an audio feedback that is different in every trial. I have several blocks, which each contain 20 sounds played randomly .
For each trial inside a block, the required number of clicks on the stimulus sequentially increases for the audio feedback to appear : at first, one click = sound ; then 2 = sound , then x …
What did you try to make it work?:
The l_clicks loop defines the number or clicks needed, which is handled by an .xlsx file attached to the l_repeats loop (In the nReps$ field, I put the header of the column in the repeats.xlsx file attached to l_repeats ):
l_blocks is attached to a condition file (ChooseBlock.xlsx)
which picks the current block listed under the “Condsfile” header. It actually lists .xlsx files which themselves each list 20 sounds as mentionned above .
Now, I created a loop called trials, and in its condition field, wrote “$Condsfile” (header of ChooseBlocks.xlsx)
And, in the r_feedback routine, which is purely in charge of playing the sounds, I have an audio component. In its “Sound” field, put “$StimFile” , which is the header row of my blocks file.
What specifically went wrong when you tried that?:
The experiment runs, but not as I would like it to.
When I place the trials loop inbetween the l_repeats and l_blocks ones, the number of required clicks indeed increases as planned, BUT the sound played is always the same.
When I place trials inside the other two, the sounds which are played changed every time, BUT the required clicks don’t, ie. it’s always one click = one sound.
----> Is there a way to get the best of both worlds ?
== Make the required amount of clicks AND the sound that is played change in each trial ?
I’m thinking there must something more elegant and efficient to do than those 3 outer loops but I have trouble coming up with the means to achieve it, so I’ll be thankful if anyone could point me in the right direction.