Portmidi closed error with voice.key

Hi!

I’m trying to create an experiment to collect vocal reaction time during a spoken word picture naming task. The goal is to have PsychoPy record both the participant’s speech (.wav files) and reaction time based on the onset of the speech.

I created an experiment using PsychoPy builder (v1.90.0 on Windows 10) and added the voicekey code component from the demo word_naming. We are using a head-mounted microphone connected to the computer via a Focusrite audio interface to collect the audio input.

The experiment runs in its entirety and collects the appropriate data (RT and .wav files) most of the time. However, occasionally after the experiment is completed I get a message stating “Portmidi closed” (see attached picture). When this happens, I’ve noticed the experiment stopped collecting .wav files and vocal_RT at some point in the middle of the experiment (but the experiment did not crash/stop). The most frustrating part is that it does not happen in a consistent fashion. Each time it has occurred at a different place in the experiment and on different trials/stimuli. I don’t think it’s a programming issue, because most of the time it works without this problem. Additionally if I run a different experiment that uses the same code for voice key directly after it, it works with no problems.

I’d greatly appreciate any insight into how to resolve this issue!