psychopy.org | Reference | Downloads | Github

How to make a key press end trial only when visual stimuli finished

Hi everyone,
I’m working with :
Debian Jessie and Psychopy v. 1.83.04

I’m trying to build trials where there are 2 visual or sound stimuli running one after another. The subject has to answer whether the two stimuli are identical or not using the keyboard. The trial ends when the participants answers.

I managed that but my problem is that, if the participant answers before the end of the sound, it makes a weird sound cut. I would like for the trial to end only at the end of the sound but the subject to be able to answer since the beginning.

What would you advice doing ?

Many thanks !

Make your keyboard and your sound have the same duration and turn off “force end of routine” in the keyboard

Thanks for your answer.

My problem is that I want the participant to be able to answer even after the end of the sound but the trial to finish either at the end of the sound if the participant answered already or after (if the answer is after the end of the sound).

Thanks again

Ah. No, there isn’t a built-in mechanism to set the keyboard to end the routine only if the response occurs after a certain point in time. You’d have to leave it as not ending the routine and create your own code component for that. e.g. something like this in your “every frame” block:

if len(resp.keys)>0 and myStimulus.status==FINISHED:
    continueRoutine = False

Great ! Thanks. I’ll try and let you know.