Triggers and Event Alignment#

DSI-Streamer showing trigger rises on the Trigger channel after serial bytes are sent from PsychoPy

DSI-Streamer showing trigger rises on the Trigger channel after serial bytes are sent from PsychoPy via the MMBT-S.#

A trigger (also called an event marker or stim marker) marks the exact moment something happens in an experiment or application. This could be a stimulus appearing on screen, a user responding, or a game event firing. The term varies by field and software, but the concept is the same: a timestamped signal recorded alongside EEG data so brain activity can be extracted time-locked to each event.

Accurate alignment matters in both workflows:

  • Offline / ERP analysis: Triggers define the epochs cut from a continuous recording. A timing error shifts every epoch by the same amount, distorting ERP waveforms and reducing statistical power.

  • Real-time BCI: During calibration, triggers define the training windows. Bad markers mean the classifier trains on the wrong data. During online control, each trigger also drives backend reshaping by telling the backend where to cut the next window for classification. Timing inconsistency at either stage degrades accuracy.

For supported trigger types and device-specific bit depths, see What type of external triggers are supported?.

Trigger Methods#

Hardware Triggers#

Hardware triggers write codes directly to the DSI trigger channel at stimulus onset, bypassing network and OS scheduling. This gives the lowest and most consistent latency.

The recommended device is the MMBT-S, a USB-to-serial adapter that connects to your stimulus computer and converts serial writes into TTL pulses on the DSI trigger channel. Your stimulus software (PsychoPy, Unity, custom scripts) writes a trigger value at each event onset. The Trigger Hub is an alternative when you need to consolidate multiple trigger sources or require input types the MMBT-S does not support.

MMBT-S USB-to-serial trigger adapter
MMBT-S — USB-to-serial trigger adapter
Wearable Sensing Trigger Hub
Trigger Hub — multi-source trigger consolidator

Guides: Hardware Triggers with PsychoPy, Unity Integration

Software Triggers (LSL Markers)#

LSL markers are sent as a timestamped stream from your stimulus application and synchronized with the EEG stream at the recording level.

  • No additional hardware required; works across the network

  • Compatible with any LSL-enabled application (PsychoPy, Unity, custom scripts)

  • Introduces a measurable timing offset and some jitter that must be accounted for in analysis

Guides: Software Triggers with PsychoPy, LSL Integration

Measuring and Correcting Trigger Offset#

Every trigger method introduces a delay between when a trigger is sent and when the stimulus actually reaches the participant. This offset depends on your setup: the presentation software, stimulus type, hardware, and OS. There is no universal value. Measure it for your specific setup and remeasure whenever anything changes, such as the computer, software, stimulus type, or hardware.

Visual stimuli: Attach a photodiode to the screen. It detects the physical light change and records the true onset on the DSI trigger channel, which you compare against your trigger signal. See the Photodiode Experiment guide for a full walkthrough using PsychoPy.

Audio stimuli: Use a Y-splitter to route your audio output. Send one side to your speakers and the other into the Trigger Hub audio input. The Hub records the audio onset on the trigger channel for comparison.

The Offset Analysis tool computes mean offset, standard deviation, and drift across trials. Once measured, apply the offset as a fixed correction to event timestamps during epoching or real-time processing.

Offline Use: ERP and Epoch-Based Analysis#

Triggers are the anchors around which epochs are cut from a continuous recording.

  • Each trigger value should map to a condition (e.g., 1 = target, 2 = non-target). Consistent coding is what allows you to average across trials and recover condition-specific ERP components.

  • Apply your measured offset when epoching so time-zero aligns with true stimulus onset, not when the trigger was sent.

Guides: MNE-Python Epoching

Real-Time Use: BCI and Game Development#

In real-time applications, triggers serve three roles:

  1. Calibration markers: Each stimulus onset is marked so the backend can extract time-locked windows and train a classifier. Marker quality directly determines classifier performance.

  2. Online window reshaping: During live control, each trigger tells the backend where to cut the next classification window. Inconsistent timing produces misaligned epochs and degrades live accuracy even with a well-trained model.

  3. Prediction delivery: The backend sends classification results to the game engine to drive in-game events.

On the backend, keep the processing loop tight. Buffer EEG into fixed-size windows, process each window as it fills, and send results immediately. Avoid blocking I/O on the processing thread.

Guides: MNE-LSL Epoching, Game Development Best Practices

Resources#