Skip to content

Lab Streaming Layer

In short, the Lab Streaming Layer (LSL) is a low-level technology that manages the exchange of time series data between programs and computers.

Figure 1. Lab Streaming Layer

Figure 1. Lab Streaming Layer

LSL Overview

LSL acts as a central communication hub connecting applications and devices across the LSL network on one clock, including: biosignal hardware (EEG, eye tracking, etc), stimulus presentations, real-time viewers, recorders, online processors, and many more. There is an intro lecture/demo on LSL here (part of an online course on EEG-based brain-computer interfaces).

Figure 2. Example applications

Figure 2. Example applications

More formally, LSL is system for the unified collection of measurement time series in research experiments that handles both the networking, time-synchronization, real-time access as well as optionally the centralized collection, viewing and disk recording of the data.

LSL was originally developed to facilitate human-subject experiments that involve multi-modal data acquisition, including both brain dynamics (primarily EEG), physiology (EOG, EMG, heart rate, respiration, skin conductance, etc.), as well as behavioral data (motion capture, eye tracking, touch interaction, facial expressions, etc.) and finally environmental and program state (for example, event markers).

The LSL distribution consists of:

  • The core transport library (liblsl) and its language interfaces (C, C++, Python, Java, C#, MATLAB). The library is general-purpose and cross-platform (Win/Linux/MacOS, 32/64) and forms the heart of the project.
  • Examples in a variety of languages.
  • A suite of tools built on top of the library, including a recording program, online viewers, importers, and apps that make data from a range of acquisition hardware available on the lab network (for example audio, EEG, or motion capture).

Figure 3. Library (liblsl) overview

Figure 3. Library (liblsl) overview

Use in NeuroScale

LSL is primarily used in NeuroScale to send and receive data from running pipelines in conjunction with the NeuroScale API; client_lsl.py is an example of this application.

The NeuroScale API handles connecting your program with a running pipeline's read and write streaming endpoints, while LSL handles the local streaming of data to and from your program communicating with NeuroScale. For example, your program can use LSL to acquire EEG data in real-time and stream out the results from NeuroScale in real-time to an application of your choosing (real-time visualization, recording, etc).

Examples

client_lsl.py

This example python program reads EEG data from a well-formed LSL data source of your choosing, sends it up to a Neuroscale pipeline, gets the result back, and then emits the result back into LSL under a name of your choice.

SendData.py

This example program demonstrates how to send a multi-channel time series over the LSL network.

ReceiveData.py

This example program demonstrates how to read a multi-channel time series from the LSL network.