MATLAB Answers

Why does matlab give a clicking sound after button presses in a reaction time experiment?

9 views (last 30 days)
Viktoria Cs.
Viktoria Cs. on 24 Aug 2019
Commented: Bruno Luong on 24 Aug 2019
I am running a reaction time experiment where I switch between operator & participant keyboards in the script.
Before it is time for the participant to respond, the script switches to the participant's keyboard, and then back to operator after response. It works fine in 80-90% of the cases, but in the remaining cases the participant hears a clicking/beeping sound after button press. (They wear headphones, so I don't hear it but I assume this is the matlab error sound.) The responses are still recorded in these cases, but I don't want the participants to hear this click.
I don't understand why this is happening, so I don't know how to fix this.
(I am using an app called Dwayne cam to record the participants through a webcam, in case it's relevant in any way.)
Thanks a lot for your response!


Adam Danz
Adam Danz on 24 Aug 2019
Is there a message that displays in the command window when these sounds occur?
As with any experiment, the experimenter needs to put the headphones on and run the experiment many many times on him or herself. The stimuli shouldn't even be exposed to a subject before the experimenter has done hundreds if not thousands of trials on their own to catch unexpected or undesired artifacts. The experimenter should stress test the code and try to break it; respond too early, respond too late, don't respond at all, press the wrong button, etc.
The matlab error "beep" can be recreated using the command below. Compare that to the sound you hear through the headphones. Try to figure out what set of conditions recreates the problem reliably. This can be very difficult and it may not be related to Matlab but those are your starting points IMO.
Bruno Luong
Bruno Luong on 24 Aug 2019
If the reaction time matters for you, you should make a realtime design, remove any OS layer and MATLAB between the HWs, put a electrical wire that is triggered by the mouse/keyboard and goes directly to the speaker, or you should catch their interrupts at the very low-level (driver).
MATLAB is anything but realtime SW.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!