Using multiple parameters and selecting one file per row to use as a stimuli

I am currently trying to build an experiment in which participants are faced with 25 audio recordings and provide a rating after each one. I have 4 versions of each recording for each of my 4 experimental conditions. How do I get my loop to choose one of the four from each row of my excel file? There are 100 files total, but I can only get it to work if theyre all under one paramater. Ideally participants would hear only one version/condition of each sentance which this does not account for.

One method is to have a spreadsheet with 25 rows and four audio file columns.

Begin Experiment

conditions = [1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4]
conditions.append(randint(4)+1) # One condition will appear 7 times.
shuffle conditions
thisFile = ''

Begin Routine

thisCondition = conditions.pop()
thisExp.addData('Condition',thisCondition)
if thisCondition == 1:
     thisFile = Audio1
if thisCondition == 2:
     thisFile = Audio2
if thisCondition == 3:
     thisFile = Audio3
if thisCondition == 4:
     thisFile = Audio4

Then put $thisFile as the audio file in the sound component.

1 Like