psychopy.org | Reference | Downloads | Github

Presenting a "false alarm" feedback

Hello,

I am searching for a solution for a specific response feedback. I also asked this question in Google Groups.

In my task, one of two tones (e.g. 440 and 3523 hz) are sequentially
presented. Participants have to react only on high tone with the button “h” (no
reaction should take place when the other tones is presented).

For correct answers participants should get no feedback, when they
missed to react to a high tone they should get a “Missed” feedback and when
they pressed the “h” button in all the other trials they should get a “False
alarm” feedback.

My Excel table looks like this:

Hz           corrAns
440         h
440         h
523
440         h
523

I implemented the following code in the “each frame” window which does not work:

if resp.corr:
  msg = ""
elif resp.keys == "h" and int(Hz) == 440:
  msg = "False alarm"
else:
  msg = "Missed"

The false alarm feedback is not presented when I press the button during a low tone trial.

At the end of the task I get the information:

avbin.dll failed to load.

Can anybody help me?

Thank you very much!

Best,

M

Don’t worry about avbin failed to load

The problem with your key-checking code is that the resp.keys is a list of keys not a single key. Either of these lines should work:

elif "h" in resp.keys and int(Hz) == 440:

(will test if “h” was one of the keys)
or

elif resp.keys == ["h"] and int(Hz) == 440:

(will test if there was only “h” pressed)

Thank you very much Jon,

now it works with:

if resp.corr:
  msg = ""
elif resp.keys is not None and "h" in resp.keys and int(Hz) == 440:
  msg = "False alarm"
else:
  msg = "Missed"

However, the tones (150 ms duration) are sometimes longer or shorter. Additionally, the feedback (150 ms) is presented about 1 trial to late. Do I have to pay attention to something specific when tones and feedback are presented so shortly?

Thank you very much!
Best,
M

1 Like

The code component must be above the text component so that the text component gets access to the current value of msg (i.e. the one set in code for this trial). Otherwise, it will still be using the value from the previous trial.

Thank you very much m-macaskill, it works!
May I ask you another question concerning my task.
How can I set a fixed time for responses. In my task, immediately after my response the next tone is presented. How can I tell PsychoPy that it should wait before the next tone is presented, even when I made a response?

Thank you very much!
Best,
M

The easiest thing to do is set a non-zero start time for your audio stimulus, so that it does not play immediately. Or alternatively, insert another routine after the first one which just shows a blank screen, or whatever is on screen on the first routine, for a particular period of time.

Thank you very much m-macaskill!
It works! :slight_smile: