| Reference | Downloads | Github

Vocal response triggers routine

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

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:

I want subjects’ vocal response to trigger the next routine inside a loop. Something equivalent to “force end of routine” for keyboard responses but instead of a keypress I want the recorded audio (microphone) to force the end of the routine. I don’t care about the specific vocal response to be recognized by the microphone as this is not the aim of my experiment.

What did you try to make it work?:
I’ve tried to use the microphone and insert some code by using the custom function like

mic_1.status == FINISHED:
continueRoutine = False

What specifically went wrong when you tried that?:

The experiment jumped the next routine by presenting directly the last routine in the loop.
I know that this is not the correct way to do it but I could not find anything else online, please help!

Thank you!

I think what you are trying to do is not a trivial thing. You might be able to use psychopy.microphone.AdvAudioCapture in a loop where you make recordings and check them for thresholds of Hz, duration and/or volume (e.g. with psychopy.microphone.getRMS) and then decide, if a response was given.

I haven’t tried this out and would be interested how you implement your feature. Keep us updated. :wink: