Hi!
I am new to Psychopy and do not have much Python and coding background, so I need some help. I am currently building a study in Builder view. I have a sequential loop (stories) that is attached to an excel conditions file. Within my loop, I have a routine (present) where I present two image stimuli (leftInformant2 and rightInformant2). Participants use a mouse component (key mouse) to click on one of those two image stimuli. Then, in a feedback routine (informantResponse) I want to give audio feedback based on which one they clicked. Specifically, if they clicked the leftInformant2 image component, I want the corresponding leftAudio from my excel file to play, while if they clicked the rightInformant2 image component, I want the corresponding rightAudio from my excel file to play.
Here are some images of what I am working with:
So, the problem is that I can’t figure out how to program the corresponding audio feedback.
I tried this in the begin routine of my feedback routine:
if keyMouse.isPressed(leftInformant2):
playsound=leftAudio
elif keyMouse.isPressed(rightInformant2):
playsound=rightAudio
And then entered this into my audio component (the “stimuli/” is a path to the folder with all the stimuli in this study):
But it is not working! When I run my study, psychopy shuts down when it gets to the informantResponse (feedback) routine. I think it has to do with my coding, cause when I delete the code, everything works fine but, of course, there is no feedback.
So if anyone could point out what I should be doing differently it would be greatly appreciated! Or if anyone has any guidelines for how to give audio feedback from an excel file based on participants’ mouse clicks that would be very helpful too! Thanks in advance!