Using the microphone in the Builder (and not fiddle with the generated code)

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version ( v2022.2.4:
Standard Standalone? (y/n) y
What are you trying to achieve?:

I am trying to get a color-naming Stroop task going with a microphone response.
(Latencies to be analyzed offline in Praat, script available on request).
However, I do not manage to get the microphone working in Builder.
The error message was:

“psychopy.sound.exceptions.AudioStreamError: Cannot stop a stream that has not been started.”

What did you try to make it work?:
I ran through the different posts on the topic, and put the sample rate to 48kHz,
but then noted, following other posts, that, in the generated script, there are two commands “mic.stop()”
if the microphone has a limited time, one related to its timing, and one in the end-routine part.

I first tried to solve this by having a really long recording (so that the first mic.stop() would never be
triggered). However, this meant that no sounds were saved.

I did get the experiment to work eventually by compiling the script by letting the builder generate the py code, and then comment out the second mic.stop in the end-routine part. In fact, the experiment is set-up in such a way that the time-out for the mic.stop() is executed, since the minimal trial duration is more than
the duration of the mic component, so this 2nd mic.stop() will never do anything.

However, I also use this to teach students and this is a rather awkward solution for beginners
and it should be possible to get this done using the Builder only.

Kind regards,