psychopy.org | Reference | Downloads | Github

Onset vs OnffVoiceKey 'sec' parameter

I’m struggling to understand the difference between OnsetVoiceKey’s and OffsetVoiceKey’s “sec” parameter. OnsetVoiceKey says “sec” refers to “duration to record in seconds”, whereas OffsetVoiceKey’s “sec” is apparently " duration of recording in the absence of speech or other sounds." I guess I still find both of these explanations confusing.

If I’m setting a 2-second cap in which someone can respond to a trial, and I’d like to record those entire two seconds (or whenever someone finishes speaking), how could I save a clip that is the entirety of that particular trial (2 seconds or less depending on when they finished speaking)? I’ve attached an attempt at this task_script_v3.py (2.5 KB) (key lines are 36-37), though I haven’t yet entered the code to end the trial early if someone finishes speaking. Much thanks in advance.