Howdy, Stranger!

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

Supported by

How to Record Keyboard Responses outside of the Block Loop?

edited February 1 in OpenSesame

Hi everyone,

I am trying to create an experiment that uses the RSVP technique. My experiment aims to find out how fast can participants detect human faces in a series of images displayed (85ms each image).

I'm using Open Sesame and have already created a draft. However, because we cannot detect a face and press for a response in 85ms, I am having an issue. I cannot use the timeout feature in the Keyboard item because after 85ms, the keyboard response for that particular image will expire in that loop.

I tried using the Coroutine item. However, it does not seem to solve what I need. The Coroutine item has a timeout function as well, so the visual sketchpad and the keyboard response are tied to the Coroutine. Hence, the keyboard response will still be 85ms.

What I need is for the image and keyboard response to run in tandem and not in serial. In Python, they call it a thread?
For example:

Stimulus Distractor, Distractor, Distractor, FACE 1, Distractor, Distractor, Distractor, FACE 2...

Keyboard Response:
When a participant sees FACE 1 (which shows for 85ms and we can't respond in time), they will press for a response. The timing of the response will likely be 400ms to 500ms. However, I'm not able to record the responses for the delayed response from the program I have drafted.

Can anyone please advise? I'm not a technical person and have a limited knowledge on python. Will appreciate it!

p/s: the program also says I have too many key loggers which may be messy. However, I have 7 conditions for my experiment. So if there's a way to put a key logger in a better way, please let me know!


  • Hi,

    the program also says I have too many key loggers which may be messy.

    The message says you have too many unlinked loggers. It is perfectly fine to add a logger to each of your 7 loops, but try to use the same logger item every time.

    As for the RSVP, I would use a while loop inside an inline_script to do the task. Below an example that should demonstrate the principle.

    import random
    # prepare a keyboard
    kb = Keyboard(timeout = 2)
    # collect all the unique displays here
    canvasses = []
    # create stimuli 
    no_stim = 18
    stim = range(no_stim)
    t_idx = random.choice(stim)
    # add text to canvas and add canvasses to list
    for n in range(no_stim):
        cv = Canvas()
        cv['stim'] = Text(stim[n],color = 'white')
    canvasses[t_idx]['stim'].color = 'red'
    cur_idx = 0
    resp = None
    stim_dur = 200
    while True:
        if resp == None:
        if k!=None:
            resp = k
            resp_time = t-t0
        if clock.time()-t1>stim_dur:
            cur_idx += 1
            if cur_idx == len(canvasses):

    Let me know if you need help.


Sign In or Register to comment.