How to transfer "keypress duration" function to online experiment?

Description of the problem:
I am transferring my experiment to online experiment.
The Psychopy builder mode also does not support the “keypress duration” function, only the “keypress frequency” and “keypress reaction time” functions. While I have been able to add the “keypress duration” function by editing the Python script, I am not certain how to transfer this function online to Pavlovia, since the online version is written in JavaScript.

Do you know how to add the “keypress duration” function to the online JavaScript file?

Thanks a lot!

1 Like

Hi Carine,
I was trying to do the exact same thing but I could not yet find how to store keypress duration too. Could you share your code with me? I would really appreciate it! :slight_smile:

Hello everyone,

Just wondering if there is a trivial way to record each key press duration from the keyboard component on PsychoJs (In PsychoPy: tDown: the time the key went down in absolute time)?

Not sure if @Carine and @pinar have found a way around this?

Cheers
Josh

Hi @Josh_Khoo

I ended up using two key presses to indicate an interval time: one to start and one to end the estimated duration. Then I just substracted t_press for key1 from key2. Therefore I don’t have a code for storing keypress duration, unfortunately.

Hi @pinar,

Thanks for the reply. Unfortunately that is not what I’m looking for.

Would @apitiot be able to help?

Cheers,
Josh

Not sure if you already figured this out, but this link should help: Measuring key lift time relative to stimulus onset

Thanks for pointing to the link! @milsandhills

1 Like