Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Time Reproduction Task

I am creating my first independent experiment and my colleague recommended OpenSesame which I love thus far. I watched your tutorial and it was very helpful. However, I am very uncertain of how to create and log the following function: 

I am creating a time reproduction task where a participant hears a tone or sees a cute for a set duration, there is a blank screen pause, then they reproduce that tone by holding the space bar for what they believe is the same duration. My difficulty is only with how to have a button press of a certain duration logged, such as pressing the space bar for 5 seconds. I want my log to show the total duration of the button press. It does not need to state the timestamp if that is not a necessary component of coding that function. I'm using Psycho for my backend.

Thank you in advance for your assistance. 


  • Hi,

    In order to do this, you need to use inline (Python-based) coding. In particular, you can use pygame's (I believe psychopy also has this functionality, but I am not sure. Maybe check it), function that gets keypress and key releases. With this function, you basically wait for a key press. Once it happened, you wait until the same key was released, and eventually take the difference between the two timestamps. See for example here for an example on how the coding could look like:

    Let me know if you need more help,


Sign In or Register to comment.