Integrating Lab Streaming Layer (LSL) with SightLab VR Pro

August 8, 2025

Lab Streaming Layer (LSL) is an open-source middleware ecosystem designed to stream, receive, synchronize, and record neural, physiological, and behavioral data across diverse sensor hardware. By bridging LSL with SightLab VR, researchers can seamlessly incorporate third-party EEG, eye-tracking, and physiological data into their virtual reality experiments, as well as export VR-derived metrics to external acquisition software.

For more information see this page


Overview of LSL

LSL provides a unified interface for real-time data transmission:

  • Networked Streams: Transmit data packets over IP, allowing multiple applications on the same or different machines to share time-synchronized streams.

  • Cross-Platform: Supports Windows, macOS, Linux, iOS, and Android.

  • Broad Device Support: Hundreds of biosignal, motion, and other research-grade sensors are LSL-compatible.

For a complete list of supported devices and applications, visit the Lab Streaming Layer device list.


Installing LSL for SightLab

Before integrating LSL with your SightLab project, install the Python bindings:

# In the Vizard IDE: Tools → Package Manager → Add Package

pip install pylsl

Then, in your script’s imports:

from pylsl import StreamInlet, StreamOutlet, resolve_stream

import sightlab_utils.sightlab as sl

from sightlab_utils.settings import *


Streaming Into SightLab (Stream Inlet)

To ingest external biosignals (e.g., EEG from Muse or BrainVision) directly into your VR session:

Discover the Stream

# Wait up to 5 seconds for an EEG stream

streams = resolve_stream('type', 'EEG')

inlet  = StreamInlet(streams[0])

  1. Add Stream to SightLab Recorder

    sightlab = sl.SightLab()

sightlab.addStreamInlet('EEG', inlet)

  1. Save to Data Files
    SightLab will automatically timestamp and include incoming samples in its recording CSVs and experiment summary.

See ExampleScripts/LSL_Sample/lsl_sample_receive.py for a complete implementation, including averaging and experiment-summary integration.


Streaming Out of SightLab (Stream Outlet)

Export VR-derived metrics—such as gaze coordinates, head orientation, or pupil diameter—to external analysis tools:

Create an LSL Outlet

from pylsl import StreamInfo, StreamOutlet

info   = StreamInfo('SightLabGaze', 'Gaze', 3, 0.0, 'float32', 'sightlab123')

outlet = StreamOutlet(info)

sightlab.addStreamOutlet('Gaze', outlet)

  1. Push Data During Trials
    Inside your trial loop or callback:

    gaze_pos = sightlab.getCurrentGazePosition()  # [x, y, z]

outlet.push_sample(gaze_pos)

  1. Use in External Software
    Common applications include:


    • BioPac AcqKnowledge

    • MATLAB (via LSL MATLAB API)

    • BrainVision Recorder

See ExampleScripts/LSL_Sample/lsl_sample_stream.py for generic outlet setup.


Workflow: SightLab → Biopac AcqKnowledge

AcqKnowledge now natively supports LSL enabling VR-derived streams to be captured alongside physiological channels.

  1. Enable LSL in AcqKnowledge


    • Display → Preferences → Hardware → Data Acquisition

    • Check “LSL” as a hardware source.

  2. Add LSL Stream


    • In your graph window, click “+”LSL.

    • Restart AcqKnowledge to refresh hardware options.

  3. Connect to SightLab Outlet


    • In a new experiment (File → New), select LSL from the hardware dropdown.

    • Press “Refresh” when your SightLab script is running.

  4. Visualize & Record


    • VR metrics (e.g., gaze path, pupil size) appear as channels in AcqKnowledge.



Troubleshooting Tips

  • “No Stream Available” upon launch?

    • Start your SightLab script to open the LSL outlet.

    • Hit “Refresh” in AcqKnowledge’s hardware menu.

  • Outlet Unexpectedly Closes

    • If SightLab exits or the outlet is closed, go to “Manage Hardware Connections” in AcqKnowledge to rediscover streams.

  • Latency Concerns

    • Ensure both applications are on the same LAN and that firewall settings permit UDP traffic on the LSL port range (default: 11000–11999).


Conclusion

By leveraging LSL within SightLab, researchers gain a versatile pipeline for incorporating and exporting rich, synchronized biosignal and behavioral data. Whether streaming in EEG for closed-loop VR paradigms or pushing gaze and kinematic metrics to Biopac AcqKnowledge, the integration empowers complex, multimodal experiments with precise timing and minimal overhead.

Stay Updated
Subscribe to our monthly Newsletter
CONTACT US 
Phone +1 (888) 841-3416
Fax +1 (866) 226-7529
813 Reddick St
Santa Barbara, CA 93103