Originally posted March 20th, 2019.
- Psychtoolbox Python PsychHID()
and found that Psychtoolbox PsychHID Python interface provided the most accurate keyboard event time stamps across all three OS’es tested, particularly for macOS.
psychopy.hardware. keyboard.Keyboard uses the Psychtoolbox PsychHID Python interface to provide accurate cross platform 1000 Hz keyboard event time stamping.
PsychoPy3’s psychopy.hardware. keyboard.Keyboard module takes full advantage of the PsychHID engine to provide accurate 1000 Hz MilliKey keyboard event time stamping on Windows, Linux, and macOS. Average event latency is ~1 msec across all operating systems.
In comparison, lets look at the performance of other PsychoPy keyboard event APIs.
Python3 psychopy.iohub keyboard event timing is not as consistent across operating systems. On Windows, and in particular Linux, iohub comes close to matching the performance of PsychHID, but macOS causes extra delay compared to other operating systems.
Results for psychopy.event.getKeys() are similarly poor across operating systems. Remember that in this test keyboard events were being created during calls to win.flip(). The timing results show how big of an impact this has on time stamping error when a 60Hz monitor is used.