OS (e.g. Win10): Big Sur PsychoPy version (e.g. 1.84.x): 2021.2.2
What are you trying to achieve?:
Dear all,
I have set up an experiment in which I play a bunch of sounds to participants (10 sounds per trial x 5 blocks) and they make a binary choice concerning what they heard. This works just fine, I’ve got nested loops around my trial routine (outer loop with a conditions file that includes the keys for condition files for the inner loop).
My problem is that I would also like to include two additional sounds in each trial that are unique to each participant (should be able to use participantID from expinfo, right?) but I don’t know how to do this.
I am new to psychopy and would greatly appreciate some input!
Please let me know if I need to provide more info.
Many thanks!
@TParsons
Thank you so much for your reply!
It is two additional and unique sounds per participant, per block - but I suppose I could use a list in the dictionary?
There are 5 blocks, let’s call them A B C D and E. In each block, 10 sounds (1A, 2A, 3A…10A) + another 2 sounds unique to each participant that I would like to include. I think your suggestion would work if I included the paths to (1A, 2A, 3A…10A) and the unique sounds in each list?
Would one have to create a dictionary for each block? The conditions file in the outermost loop only includes the names of the conditions file for the inner loop (trials within block).
Would I add the code component in the Begin Experiment tab?
Thank you again
I think you could also add a code component at the beginning of one of your first routines in which you create the sound names relative to each participant like
This means you do have to have wav files named subject1_A.wav, subject1_B.wav, subject2_A.wav, and so on.
Then for each block you can read your spreadsheet, add your customized sounds, and rewrite it
my_file = open(my_spreadsheet_blockA)
my_stim_list = my_file.readlines()
filename_to_write = _thisDir + os.sep + 'blockA_customized.csv'
with open(filename_to_write,'w') as out:
out.write(''.join(my_stim_list+[my_sound_A]+[my_sound_B]))
And in the loop of each block you enter block?_customized.csv as your condition file.
Might not be the most elegant way but I would try something like that.