Millisecond Forums

How to measure and record response latency

https://forums.millisecond.com/Topic32221.aspx

By Claude Choe - 9/12/2021

Hello.

I am currently customizing the auditory digit span task: https://www.millisecond.com/download/library/digitspan/
and translating it into Japanese.
The point of customization is to add a feature of measuring response latency for each trial (from the point of digits (stimuli) presentation to that of response confirmation).
Even if I added some related codes on it, the output column of (values.rt) shows only "0" for all trials.
It would be appreciated if you could let me know how to fix this.

Here's what I added (For forward level 3)

<data>
/ columns = (~, values.rt)
</data>

<values>
~
/rt = 0
</values>

<trial f_trial3>
/ ontrialend = [
   ~
   values.rt = trial.f_trial3.latency;
    list.rt.appenditem(values.rt);
]
/ recorddata = true

By Dave - 9/13/2021

Claude Choe - 9/13/2021
Hello.

I am currently customizing the auditory digit span task: https://www.millisecond.com/download/library/digitspan/
and translating it into Japanese.
The point of customization is to add a feature of measuring response latency for each trial (from the point of digits (stimuli) presentation to that of response confirmation).
Even if I added some related codes on it, the output column of (values.rt) shows only "0" for all trials.
It would be appreciated if you could let me know how to fix this.

Here's what I added (For forward level 3)

<data>
/ columns = (~, values.rt)
</data>

<values>
~
/rt = 0
</values>

<trial f_trial3>
/ ontrialend = [
   ~
   values.rt = trial.f_trial3.latency;
    list.rt.appenditem(values.rt);
]
/ recorddata = true


Each "trial" in the digit span encompasses multiple <trial> elements, and f_trial3 has a duration of zero and is not responsible for measuring any response. You'll want to store script.elapsedtime in a variable /ontrialbegin the the various f_trialX and b_trialX <trial> elements (or the timestamp property of the 1st digit audio <sound> stimulus /ontrialend if you want to measure from onset of the 1st digit presented) and then store script.elapsedtime again in a different variable in the f_trialX_responseInput and b_trialX_responseInput <trial> elements if the response there submitted is "submit". Then subtract variable 1 from variable 2 and you have your latency.
By Claude Choe - 9/14/2021

Dave - 9/13/2021
Claude Choe - 9/13/2021
Hello.

I am currently customizing the auditory digit span task: https://www.millisecond.com/download/library/digitspan/
and translating it into Japanese.
The point of customization is to add a feature of measuring response latency for each trial (from the point of digits (stimuli) presentation to that of response confirmation).
Even if I added some related codes on it, the output column of (values.rt) shows only "0" for all trials.
It would be appreciated if you could let me know how to fix this.

Here's what I added (For forward level 3)

<data>
/ columns = (~, values.rt)
</data>

<values>
~
/rt = 0
</values>

<trial f_trial3>
/ ontrialend = [
   ~
   values.rt = trial.f_trial3.latency;
    list.rt.appenditem(values.rt);
]
/ recorddata = true


Each "trial" in the digit span encompasses multiple <trial> elements, and f_trial3 has a duration of zero and is not responsible for measuring any response. You'll want to store script.elapsedtime in a variable /ontrialbegin the the various f_trialX and b_trialX <trial> elements (or the timestamp property of the 1st digit audio <sound> stimulus /ontrialend if you want to measure from onset of the 1st digit presented) and then store script.elapsedtime again in a different variable in the f_trialX_responseInput and b_trialX_responseInput <trial> elements if the response there submitted is "submit". Then subtract variable 1 from variable 2 and you have your latency.

Thank you for the concise and informative reply.
I solved the problem based on your suggestion and the following thread:
https://www.millisecond.com/forums/Topic7530.aspx
I put script.elapsedtime on each trial elements and
used expressions element to briefly obtain the response latency.

I appreciate your help again.