Change time window for registering events

URL of experiment: Sign in · GitLab
task3.psyexp (166.4 KB)

Description of the problem:

I have a problem with an online experiment I am currently setting up (PsychoJS), which concerns the time window where key presses are registered and action is taken (i.e., a stimulus changed) if certain conditions are met.

There are 8 keys in total. Each of these keys have to be combined with the 7 other keys. A combination of two keys, pressed at the same time, will result in a change of a stimulus, namely a change in the size of a symbol representing this distinct combination of keys on the screen.

The attached setup does what it is supposed to do, however, subjects need to be very precise in hitting the two keys at the same time. Checking if two buttons are pressed is performed at the screen refresh rate of 60 Hz, which means that the temporal window where two keys need to be pressed is 16.6 ms. This is quite challenging for the subjects. Would it be possible to allow for a larger temporal window, say 100 ms. Two buttons pressed during that (100 ms) time window will change the stimulus?

best wishes

Christian

I thought about it and found a solution that works for the “offline” version (Python):

Every frame, the last two elements of a list containing the types of key presses are analysed and checked if they meet the required condition (e.g., ‘s’ and ‘d’ are pressed). Further, I subtract the clock time of the second last element from the clock time of the last element and check if the result is below 100 ms. The stimulus is changed in case conditions are true.

This, however, does not work online. I think there are parts of the code that don’t work properly.
task4.psyexp (157.1 KB)

best, Christian