Hello Viviana
might need some testing, but the following code should mix randomly pictures with sounds and presents two different sounds to each picture (I’m using text-components instead of pictures and sounds):
Begin Experiment tab:
list_ok = False
double_stim = False
picture = " "
soundfile = " "
ldx = 0
index = [x for x in range(96)]
shuffle(index)
picList = [x for x in range(48)]*2
picList.sort()
wavfileList = [x for x in range(24)]*4
shuffle(wavfileList)
while list_ok == False:
for i in range(len(wavfileList) - 1):
# check for equal neighbours:
if wavfileList[i] == wavfileList[i + 1]:
double_stim = True # D'oh!
break # can stop checking on this run
if double_stim == True:
shuffle(wavfileList) # try a new order
double_stim = False
else:
list_ok = True # Yay! The loop won't run again.
Begin Routine tab
ldx = index.pop(0)
picture = picList[ldx]
soundfile = wavfileList[ldx]
End routine tab
thisExp.addData("picture", picture)
thisExp.addData("sound", soundfile)
picture and sound are two variables which I display via two text-components.
The trial is repeated with the help of a loop
You need some code to read in your stimuli. I used numbers to simplify it for me.
Best wishes Jens