OS: Monterey 12.7.5
PsychoPy version : 2024.1.1
Hi all!
I am conducting a picture naming experiment where I would like to record the vocal reaction time. Reaction time would be from when an image is presented to the moment when participants start to speak to name the image.
I have included the ‘mic’ from the response options in the builder, but the csv file I get only reports mic.start which corresponds to the moment the microphone is triggered and is active (the RT in ms is too quick to correspond to voice onset). I don’t have much coding experience, therefore use the Builder to design experiments.
Does anyone know how to get accurate vocal RTs for this type of design?
Thank you in advance!
I’m working on something like this at the moment. I haven’t set it up for RTs yet but here is my code (in Each Frame) to determine the background threshold (max volume during the first minOnset seconds)
micVol = mic.device.getCurrentVolume(timeframe=.1)
if hasattr(micVol, "__len__"):
if t < minOnset/2:
pass
elif t < minOnset:
if micVol[0] > threshold:
threshold = micVol[0]
elif micVol[0] > threshold * 2 and wordOnset == 0:
wordOnset = t
elif micVol[0] < threshold * 1.5 and wordOnset > 0 and wordOffset == 0:
wordOffset = t
The timeframe parameter is the period over which the volume is averaged by getCurrentVolume. The default is .2 seconds. Longer gives you a smoother volume distribution but shorter should give more accurate RTs.
Thank you!
I have put your code into Each Frame, but I get this error message:
micVol = mic.device.getCurrentVolume(timeframe=.1)
NameError: name ‘mic’ is not defined
How do I define that?
What is your microphone component called?
micVol = MicImage.device.getCurrentVolume(timeframe=.1)
Once that is fixed, I get the following error message:
micVol = micImage.device.getCurrentVolume(timeframe=.1)
AttributeError: ‘MicrophoneDevice’ object has no attribute ‘getCurrentVolume’
Are you trying to run this online?
No, on my laptop (which is a MacBook Air)
I’ve just noticed that you are using 2024.1.1. This feature was added in 2024.2. You could try the latest version or wait a few days for 2024.2.5