I’m trying to conduct the stroop test and I want to include a buzz whenever the participant makes a mistake. I went through YouTube videos and some of the posts about the same topic and I tried to mimic the procedure. However, whenever the experiment starts and when it’s supposed to give a noise it crashes.
I’m attaching snippets from the experiment, the code and the error that I got. Just as a note in the code you’ll find the “a” variable, it’s just a dummy variable to fill in the if statement.
Your help is much appreciated.
Thank you in advance.
Thank you for reply. It worked. However, now, whether the keyboard response is correct or not the buzz sound will play. Do you have any idea why is this happening?
you don’t need an if…else construction, if you don’t use the else-part.
if not key_resp_4.corr:
buzz = soundfile[0]
should do the work. The reason that the sound is always played means that the if…else construction always evalutes to the else-part.
When you want to play the sound after the participants has reacted you have to move the code-element from the Begin Routine tab to the End Routine tab.
Thanks for your reply. I removed the else part and shifted the code from the “Begin Routine” to the “End Routine” tab. When I run the experiment, the following error occurs.
File “C:\Users\Other user\Desktop\Noise Experiment\Noise Experiment_1_lastrun.py”, line 387, in
sound_1.setSound(buzz, hamming=True)
NameError: name ‘buzz’ is not defined
Experiment ended.
The “buzz” is defined in the sound component shown in the figure below.
I tried to move the sound component above the code component (maybe it was an order problem) but the same error occurred.
did you ever define the variable buzz somewhere before you use it for the first time, e.g. in the tab Begin experiment? The code-element should appear before the sound-element.
Hi
I am stock in the same problem.
how can i define the vairable buzz? i know how to define a massege. e.g :msg=" "
but how to define a sound?
i tried
soundfile = “incorrectBUZZER.wav”
here a small example which plays a sound when inccorrect and no sound when correct. I simply set the loudness to 0 when the response is correct while defining the same sound file for correct and incorrect answers.
as a matter of fact the code could be even simpler. You only need to set the loudness in your if…else construction. You do not have to set your feedback-file in the if…else construction.