Can I log recording onset time when using the voice key?

Hi,

I’m using the voice key code component exactly as it is in the ‘word naming’ demo, it works fine but I need to log the onset time of the recording so I can check that it is synched to my stimuli presentation. I’ve tried the code below but the timings come out as ‘0’ (compared to the stimuli onset timings which are slightly >0), so I’m assuming they’re wrong. Can anyone advise how to correctly do this? (I’m a newbie coder, sorry):

Create a voicekey to be used:

vpvk = vk.OnsetVoiceKey(sec=30,file_out=‘data/stimuli.wav’)

Startit recording (and detecting):

vpvk.start()
vpvk.tStart = t
thisExp.addData('RecordOnset', vpvk.tStart) 

Thanks for your help,

Briony

In case anyone wants to know, I solved this by using the following code in the voice key code component:

Begin routine tab:
vpvk.start()
vpvk.tStart=trialClock.getTime()

End routine tab:
thisExp.addData(‘recordOnset’, vpvk.tStart)
thisExp.addData(‘WordOnset’, Stimuli.tStart)

This logs the recording and stimuli (word) onset in the final csv data file for each trial. So far the voice key recording is reliably synched to the stimuli by <1ms, so the accuracy is good enough for calculating accurate VOTs.

3 Likes