| Reference | Downloads | Github

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


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.tStart = t
thisExp.addData('RecordOnset', vpvk.tStart) 

Thanks for your help,


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

Begin routine tab:

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.