> For the complete documentation index, see [llms.txt](https://help.imotions.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.imotions.com/lab/getting-started/multimodal-data-overview/timestamping-and-synchronization-method.md).

# Timestamping and synchronization method

Understand how iMotions Lab timestamps and synchronizes data from multiple sensors, which latencies remain and how to reach near-millisecond precision.

iMotions Lab records data from many sensors in one study and places all of it on a common timeline. This article explains how iMotions timestamps and synchronizes those data streams, which latencies the method compensates for and which it cannot, and what you can do when your research needs near-millisecond precision.

## Why perfect synchronization is hard

A multimodal study combines, for example, eye tracking, GSR, facial expression analysis and EEG. To combine their results, the data streams must be synchronized on a common timeline. Several latencies make perfect synchronization difficult, both when a stimulus is presented and when a response is recorded.

### Latency in stimulus presentation

![Latency between the command to show a stimulus and the stimulus appearing on screen](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-bd0a22517115744e4291c887b577016eea7e0cf4%2F9ac04188b1_hc_latency_stimuluspresentation.png?alt=media)

Presenting a stimulus, such as an image, a video or a website, starts with a command from iMotions to, for example, a video player. The video player needs a few tens or even hundreds of milliseconds to execute the command, so the time the command is sent is not the time the video starts playing. iMotions therefore records both times; see [Slideshow events](#slideshow-events).

### Latency in recording a response

![Latencies between an event in a stimulus and the response appearing in the data](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-f97e1416d39de39437fe19016e34adf4f0ec42f0%2F4b22c370b4_hc_latency_recording.png?alt=media)

A response is evoked by an event in the stimulus, but it does not appear in the data at the same moment. For example, a funny moment in a video can cause an arousal peak in GSR that only shows in the data a few seconds later. Several factors contribute:

* **The biological response.** This is usually the largest part of the latency. The brain needs time to process an event, and depending on the response (a saccade, a smile, an arousal peak in GSR, an increase in alpha activity in EEG), it takes from a few hundred milliseconds to a few seconds before the response happens.
* **The hardware.** A sensor needs from a few milliseconds to a few tens of milliseconds to register a response. If the hardware computes metrics from a larger time window, the delay can grow to a few seconds.
* **The communication between hardware and computer.** Depending on the protocol, sending data from the sensor to iMotions takes from a few tens to a few hundreds of milliseconds:
  * A wired connection is the most reliable (no data loss) but not necessarily fast.
  * Wi-Fi is reliable and fast, but its latency varies a lot, from 5 milliseconds to several hundred milliseconds.
  * Bluetooth is more prone to data loss and slower, but varies less, between 25 and 50 milliseconds.
  * Many devices send data in packages of many samples rather than sample by sample. The last sample in a package can be a few milliseconds old when it arrives, the first a few hundred milliseconds.
* **Live visualization.** After data arrives in iMotions, it takes a little time before it appears in the live viewer. This only affects the display, not the recorded data.

Some of these factors can be handled in software. Others, such as the speed of the brain or the precision of the hardware, cannot: iMotions cannot be more precise than the data the hardware delivers, but it can compensate for the latencies the hardware introduces.

## How iMotions synchronizes data

iMotions combines several strategies to minimize the latencies above.

### Timestamping

iMotions relies on the internal clock of each sensor. Sensors report time in one of two ways, and iMotions handles each differently:

* **The sensor reports timestamps**, typically in seconds or milliseconds. iMotions places the samples according to these timestamps.
* **The sensor reports sample numbers** (sample 1, sample 2 and so on). iMotions calculates the timestamps from the sampling rate. For example, a sensor sampling at 200 Hz gets samples spaced 5 milliseconds apart.

In both cases, the timestamps in iMotions are as precise as those from the hardware, without the delays of the communication protocol.

### Point of synchronization

iMotions synchronizes the sensors at a point of synchronization at the start of the recording, and all samples are timed relative to that point. A high CPU load at that moment can increase the offset between sensors, so iMotions uses two strategies to keep it small:

* Data from all sensors must already be streaming into iMotions before the recording starts. A recording can only start when the connection to each sensor is established.
* The point of synchronization is placed after all other commands related to starting the recording have run. The CPU load is then low, and the system can focus on processing data from that point on.

### Device-specific latency settings

To account for the remaining offsets, iMotions applies a latency estimate for each type of sensor. Some estimates come from the manufacturers' documentation and others from our own tests, in which we triggered the sensors with an electrical pulse. For example, the offset of a Shimmer device is about 28 milliseconds, and the offset of an ABM EEG headset is set to 40 milliseconds based on ABM's documentation.

iMotions uses these estimates by default, and you can change them; see [Latency settings](https://help.imotions.com/lab/study-setup-and-design/imotions-setup/latency-settings.md).

### Slideshow events

For stimulus presentation, iMotions records the computer's UTC timestamps both of when it sends a command and of when, for example, the video player reports that the video is playing.

![Slideshow events StartSlide, StartMedia, EndMedia and EndSlide on the timeline](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-fb20618d58b710113b37309c8ef8b84f7037e54a%2F8d0c4fb85f_hc_slideevent.webp?alt=media)

The [sensor data export](https://help.imotions.com/lab/exports/export-sensor-data.md) includes columns for these slideshow events. The **SlideEvents** column contains four events, in this order:

| Event      | Meaning                                                                               |
| ---------- | ------------------------------------------------------------------------------------- |
| StartSlide | iMotions sends the command to show the stimulus (slide) on screen.                    |
| StartMedia | The media player reports that the stimulus, for example a video, has started playing. |
| EndMedia   | The media player reports that the stimulus has ended.                                 |
| EndSlide   | iMotions ends the slide.                                                              |

Visualizations in iMotions, for example in the replay, always show the data from StartMedia to EndMedia, which is the time the stimulus is actually on screen.

## When timing precision matters

The standard precision of iMotions is in the range of tens of milliseconds, and iMotions adds no delays on top of the latencies of the hardware. That is precise enough for most research. Most responses measured with eye tracking, GSR, facial expression analysis or EEG are much slower than that. An arousal peak in GSR, for example, typically comes several seconds after the event, with large differences between events and between respondents.

Research that measures reaction times or event-related potentials (ERPs) in EEG needs near-millisecond precision. For that, iMotions supports the following tools.

### Specialized hardware

Photodiodes, trigger boxes (TTL) and external synchronization units give more precise timing. For the most precise measurement of when a stimulus appears on screen, place a photodiode in a corner of the screen. See:

* [Slide Show Setting: ABM ESU and the Cedrus StimTracker ST-100 for EEG / ERP studies](https://help.imotions.com/lab/study-setup-and-design/stimuli/advanced-stimulus-markers/slide-show-setting-abm-esu-and-the-cedrus-stimtracker-st-100-for-eeg-erp-studies.md)
* [Set Up for Event-related Potential (ERP) Analysis with actiCHamp](https://help.imotions.com/lab/sensor-setup/eeg/brain-products/set-up-for-event-related-potential-erp-analysis-with-actichamp.md)

### API events

You can send events to iMotions live through the API. If the events are generated on the same computer that runs iMotions, you can include their UTC timestamps in the events, which places them exactly on the iMotions timeline. See [iMotions API Overview](https://help.imotions.com/lab/sensor-setup/api/imotions-api-overview.md).

If your research needs the highest possible precision, contact us and we will help you find the best setup.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.imotions.com/lab/getting-started/multimodal-data-overview/timestamping-and-synchronization-method.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
