psychopy.org | Reference | Downloads | Github

Double tap required with touch screen

Hello everyone,

I’m trying to run an experiment with a correct and wrong answer that can be clicked with the mouse (just one click). The experiment must be executed from a touchscreen laptop, but it seems it requires double tap for response (while mouse still requires one click). The experiments runs perfectly apart from this…

Does anyone know how to solve this? I didn’t write the code, just built the experiment, but if helps I’ll put the code of the mouse-response down the picture.

correct = new visual.ImageStim({
win : psychoJS.window,
name : ‘correct’, units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [(- 0.2), (- 0.3)], size : [0.15, 0.15],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -4.0
});
wrong = new visual.ImageStim({
win : psychoJS.window,
name : ‘wrong’, units : undefined,
image : ‘files/wrong.png’, mask : undefined,
ori : 0, pos : [0.2, (- 0.3)], size : [0.15, 0.15],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -5.0
});
mouse = new core.Mouse({
win: psychoJS.window,
});
mouse.mouseClock = new util.Clock();
// Initialize components for Routine “feedback”
feedbackClock = new util.Clock();
soundfile = [“files/check.wav”];

I’ve just written it up briefly here:

@wakecarter thanks for your feedback, now the one-tap works fine! It raises another problem, though. I have two buttons (a green one called “correct” and a red one called “wrong”), and it was programmed to play a “wrong” or “right” sound (depending on the answer, sometimes green is right, sometimes is wrong), but now it only plays the “right” sound on both of them. I have another routine that sets up the feedback sounds and a code with Auto->JS (it didn’t work on Py):

Begin experiment

soundfile = [‘files/sound_correct.wav’, ‘files/sound_wrong.wav’]

Begin routine

if mouse.isPressedIn(correct):
sound = soundfile[1]
else:
sound = soundfile[0]

As per my crib sheet, you shouldn’t use sound as a variable name.

Personally I would set up the two sounds as different sound components and then play them as appropriate (again some details of this on my crib sheet).