Lab Streaming Layer: Difference between revisions

From biophysics
Jump to navigation Jump to search
Line 11: Line 11:
==LSL in Matlab==
==LSL in Matlab==


Generic lsl functions can be found in the biofysica toolbox.  
Generic lsl functions can be found in the biofysica toolbox in the directory <..\liblsl>.  
*Each lsl-device can have one or more lsl-streams.
*Each lsl-device can have one or more lsl-streams.
*An lsl-stream is identified by a type and a name.  
*An lsl-stream is identified by a type and a name.  

Revision as of 11:04, 1 April 2026

Introduction

Lab Streaming Layer (LSL) is an open‑source software framework designed to make it easy to send, receive, and synchronize data streams in real time. It acts like a universal “data highway” that different devices and programs can use to communicate with each other.

LSL is commonly used in research settings—especially in neuroscience, psychology, and human‑computer interaction—to collect data from multiple sources at the same time. For example, you can stream EEG signals, motion‑tracking data, eye‑tracking data, and experiment events through LSL and keep them perfectly time‑aligned. It is typically used to: - Connect different sensors and software tools without worrying about compatibility - Record synchronized data from multiple devices - Build experiments that require real‑time data exchange - Store all incoming data in a single, well‑organized format

LSL in Matlab

Generic lsl functions can be found in the biofysica toolbox in the directory <..\liblsl>.

  • Each lsl-device can have one or more lsl-streams.
  • An lsl-stream is identified by a type and a name.
  • The function lsl_resolver checks if it can find the requested lslStream on the intranet.
  • When the stream is found you must add it to the session.
  • The session controls the actual data-acquisition with start and stop.
  • The data is read from the stream.

Matlab Example

type = 'EyeSeeCam @ dcn-pl04';
name = 'EyeSeeCam SCI Data';
lslSession = lsl_session;
type = 'Digital Events @ lslder01';
name = 'Digital Events 1';
lslString = sprintf('type= %s and name= %s', type, name);
info=lsl_resolver(lslString);
lslStreams = lsl_istream(info{1});
lslSession.add_stream(lslStreams);