Time reaction by vocal key on coder

Hey everyone,

I want to registrate the time reaction of the initiation of a vocal key on stimuli response.

Here’s my code with the key response ‘m’: break + registration of time reactions (rts)
The stimulis are separated with a fixation cross

I don’t want to record the response, only the latency between the stimuli presentation and the vocal response and to register it but I don’t find the answer.

Can someone help me please?

Thank you,

Anastassia

for i in range(d.shape[0]):
#isi
HISI=core.Clock()
while HISI.getTime()<0.25:
isi.draw()
w.flip()

#croix
HCROSS=core.Clock()
while HCROSS.getTime()<0.25:
    cross.draw()
    w.flip()

#stim
stim=visual.TextStim(w,text=d.Items[i],color=d.Couleur[i],height=30)
stim.draw()
w.flip()

#rep --> clé vocale + ajouter 2000 ms max??
event.clearEvents()

H=core.Clock()
while True:
    stim.draw()
    w.flip()
    if event.getKeys('m'):
        rt=H.getTime()
        break
print(rt)
d.loc[i,'rts']= rt
print(d)