Standardise keypress latency?

nsankaran's icon

Hi everyone,
I'm conducting research in musical psychophysics. I'm interested in prediction/expectation and am hoping to use max as a platform to do some reaction time measurements. The subject will hear the physical stimulus (a melodic contour) and register a response as to the direction of contour with a keypress ("up" "down" or "same"). Faster reaction time means faster neural processing means stronger expectation.

The USB keyboards seem to have a nontrivial (~15-50ms) latency due to the quantisation of the PC clock and built in keyboard delays. The problem is the jitter on this value. Is there a way within max, if not to remove key press latency altogether, to standardise the latency so that the total response time can be calibrated?

I've scoured the forums a bit to no avail. Also this paper reports a 1ms temporal precision with keypress detection in max but doesn't mention how this was achieved. -

We have access at the lab to all the standard psych response gadgets but they only seem to be compatible with matlab.

Thanks in advance -- Narayan

Peter Castine's icon

Ask the authors?

If it's a question of talking to drivers from Max, I've written several custom objects over the years that are wrappers around device drivers for special-purpose hardware. As long as the driver has decent documentation, it's usually fairly straight forward. "Straight forward" does not mean "over a coffee break," more like a couple of days, and it can vary quite a bit, depending on accuracy of the driver documentation, how complex the driver (and/or the device) is, and various other imponderables.

But, basically, it can be done and there are a couple of people around who could do that sort of thing.

USB Keyboards are going to have a fair amount of latency no matter how you cut it because they're not designed as millisecond-accurate input devices. That's just not what they're built for.

I wonder what a USB keyboard would cost if it were built for such low latency?

Cycling '74's icon

Hi @nsankaran,

I suspect trying to reduce the jitter in a USB keyboard response could be frustrating.

I have some experience conducting experiments that are structurally similar to this. To really be accurate, how about using a piano keyboard, or some other physical sound-producing device. For each test record a stereo track of the whole test. On one channel, use a microphone to record the stimulus that the subject is hearing. On the other channel, record the output of whatever device the subject has been instructed to use.

nsankaran's icon

Thanks for the feedback. For now I'm using piezo transducers as buttons. Recording at 96k it works well with low latency and almost no jitter.