Related Experiment Video
Updated: Dec 15, 2025

05:19
Using Neuron Spiking Activity to Trigger Closed-Loop Stimuli in Neurophysiological Experiments
Published on: November 12, 2019
7.4K
Implementation of stimuli with millisecond timing accuracy in online experiments
Zhengguo Gao1, Biao Chen1, Tianwen Sun1
1Department of Biomedical Engineering, School of Life Science, Anhui Medical University, Hefei, Anhui Province, People's Republic of China.
Plos One
|July 11, 2020
Summary
Web technologies like requestAnimationFrame (rAF) show promising timing accuracy for online psychology experiments. With real-time priority, rAF approaches Psychtoolbox precision, enabling reliable millisecond timing for web-based research.
Area of Science:
- Psychology
- Computer Science
- Human-Computer Interaction
Background:
- Online experiments are increasingly prevalent in psychological research.
- High temporal precision is crucial for many psychology experiments.
- Existing web technologies may have limitations in timing accuracy.
Purpose of the Study:
- To evaluate the timing accuracy of various web technologies for psychology experiments.
- To determine if web technologies can achieve millisecond timing precision.
- To compare web technology performance against a gold standard (Psychtoolbox).
Main Methods:
- Generated visual stimuli (dynamic sinusoidal grating, flashes) using setInterval, CSS3, and requestAnimationFrame (rAF).
- Tested technologies across multiple browsers (Chrome, Firefox, Edge, IE) and operating systems (Windows, macOS, Linux).
- Compared timing accuracy against Psychtoolbox under normal and real-time priority processing.
Main Results:
- requestAnimationFrame (rAF) with real-time priority demonstrated the highest timing accuracy among tested web technologies.
- rAF's timing accuracy was comparable to Psychtoolbox in most scenarios.
- A notable exception was observed with poor timing accuracy for rAF on Linux.
Conclusions:
- requestAnimationFrame (rAF) provides a viable technical foundation for achieving millisecond timing accuracy in online experiments.
- This advancement can significantly benefit the field of psychology by enabling more precise web-based research.
- Further investigation into platform-specific performance, particularly on Linux, may be warranted.

