Feedback skipping first trial

OS (e.g. Win10): Macbook
PsychoPy version (e.g. 1.84.x): PsychoPy3 v2020.2.5
What are you trying to achieve?: I have an audio task in which participants hear a sound, then decide which of two categories it belongs to by pressing S or L on the keyboard. After they make their choice, they are to receive immediate feedback (“Correct!”, or “Incorrect.”). I have done this successfully with visual stimuli in the past but am having issue with the feedback in this audio task. What is happening: First sound plays, I press (L which is the correct answer), and screen goes black without presenting text feedback. Second sound plays, I press key and receive feedback correctly, and this happens for the rest of the trials.

What did you try to make it work?: I have an excel sheet with the A column labeled sound5_wav and then list all of the .wav files. In column B, it is labeled answer5, and then the correct answers (s or l) are listed in order next to the .wav file.
For the sounds i have:

For the feedback I have:

Overall, I can’t figure out why it is not showing the feedback for the first trial and need some help!



This is almost certainly because your code component is below your text component. Components are executed in order from top to bottom, so you want the code component to be above any other component(s) that will refer to any variables it creates. In this case, I guess on the first trial, the empty value '' you initialise at the start of the experiment will be used, and then after that, the feedback will always lag behind by one trial.

Simply shift the code component upwards, by right-clicking on its icon.

Note that this is a situation where it is safest not to provide an initial value for the variable at the start of the experiment, because if things are working properly, that initial value should never be needed. If you didn’t have that code, you would have received an explicit error on the first trial that respond had not been defined, letting you know straight away that there was a problem. i.e. in this case, providing an initial value masked the real problem.


That makes perfect sense! So happy it was an easy (and silly on my part) fix. It’s working now, thanks so much for your help. :blush: