Howdy, Stranger!

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

Supported by

Multiple responses and tone during coroutine


I have been trying to implement an experiment in which subjects can give two keyboard responses while they see a fixation cross, followed by some text and a tone that is played during the text display. Only if there is a "first" response, the experiment should check for a "second" response in the trial.

Sounds easy enough, but somehow I am not able to get it to work.

Since subjects should be able to respond during the whole trial (i.e., even during fixation and befor the tone has been played), I used the coroutine plugin with two "keyboard response" items. I also tried doing this with just one keyboard response item that is reset after a response, which I could not get to work; and also tried using just an in-line script with "while" loops but was not able to present anything while OpenSesame was waiting for responses. I also tried setting the "runif" or "starttime" properties of the second keyboard response only after the first response, which unfortunately did not work.

The problems with the coroutine solution are as follows:

  • When I just set up the coroutine to end after the second response, the first response sometimes is not recognized, so I need three key presses to proceed.
  • In other cases the trials advance immediately after the first response. In these instances, the first response is logged as "None"

I then added an in-line script with a generator function that should get the coroutine to start checking for a second response only after a first response is given.

  • With this, the responses seem to be logged okay and trials only advance after two responses, but at some undefined point, python crashes. From then on, trials are of course displayed way too long and responses are not registered correctly or at all. I suspect this is due to my limited python knowledge, but as of now I could not isolate the issue.

I have attached an experiment with boiled down versions of the two variants that I tried out. 10 trials without a generator function for the coroutine and 10 trials with a generator function for the coroutine. I also attached a small logfile of a run in which I just alternated between pressing 1 and 2.

Any input would be greatly appreciated.



Sign In or Register to comment.