Using voice_key on Mac and Windows 10

Hello everyone,

I have trying to use voicekey function to get reaction time on spoken word production in a picture-word interference task. The overall goal is to get PyschoPy record participant’s speech and save it as a .wav file during each trial. I have been trying to use PsychoPy in either Mac High Sierra or Windows 10.

I am able to run the PyschoPy demo, word_naming. However, when I created my own experiment and copied the exact same voicekey code components. The voicekey stopped working normally. Does anyone know how to solve this problem? I have attached the error code below:

Error code: (I ran it in Mac High Sierra)
pyo version 0.8.6 (uses single precision)
Portmidi warning: no midi device found!
Portmidi closed.
2018-06-28 17:05:15.556 python[30753:5129842] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
File “/Users/hungshao/Desktop/letter_naming”, line 94, in
file_out=‘data/trial_’+str(trials.thisN).zfill(3)+’_’+word+’.wav’)
NameError: name ‘trials’ is not defined
Exception TypeError: “‘NoneType’ object is not callable” in <bound method Server.del of <pyolib.server.Server object at 0x12400c850>> ignored

A persistent problem I have is that I can’t seem to get PsychoPy to record any speech input either through the voicekey function or through the microphone option in the Builder. The problem seems to do with Pyo? If I don’t want to use Pyo, are they other more stable alternative options?

I would like to keep using PsychoPy but all of my experiments are speech-production related so I really need to use the voicekey or microphone function.

I would greatly appreciate your helps and suggestions. Thank you very much!

Best,
Hung-Shao

Where is that code located (ie in what code component tab and on what routine)? It seems to be running before your loop is created (or the loop has a name other than trials).