1

I've created an experiment in psychopy builder in which participants must vocally name pictures presented onscreen (for example, if a picture of a chair appears, the participant has to respond by saying "chair"). I've set up a code component to detect each vocal response, which ends the trial and initiates the next one. This part of the experiment works well, however I'm having trouble integrating EEG recording.

Some important information: My trial loop reads images and triggerVal's out of a .csv file. I have an image component (called english_naming) that displays images for participants to name out-loud. The component's STOP field is defined as $vpvk.event_onset - this forces the trial to end and the next one to begin upon detection of a vocal response.

So, here is my (working) code component at present:

Begin Experiment:

from psychopy import parallel
port = parallel.port(address=61432)

Begin Routine

vpvk = vk.onsetVoiceKey(
        sec=10)  # creates the voice key

vpvk.start() #starts recording.

port.setData(triggerVal) # tells psychopy to read trigger values from the .csv file

End Routine

vpvk.stop() # ends the recording

port.setData(0) # resets the trigger value to 0 for the start of the next trial

My problem is this

At present, parallel port events are time-locked to the start of each trial, but I need them to be time-locked to participant's vocal responses. I tried inserting if vpvk.event_onset(): above port.setData(triggerVal), but this fails to generate any trigger codes at all. I've also tried if english_naming==FINISHED but the same problem occurred. I've tried a bunch of variants on these two lines of code, but nothing I can think of seems to work.

I would really really appreciate any advice on this problem. Thanks in advance!

Lyam
  • 123
  • 2
  • 14
  • I'm not too familiar with this class but I imagine that your checking for the event onset needs to be done on every frame rather than at the start of the routine. But even then, the time at which an event is detected will not actually be the time of the event, but will lag quite a bit. I suggest you take this question to https://discourse.psychopy.org for further discussion. You might even get an answer there from Jeremy Gray, who wrote this code. – Michael MacAskill Jan 25 '17 at 20:50
  • Thanks Michael! I will do that – Lyam Jan 26 '17 at 12:41

0 Answers0