Skip to main content

LSL Streaming

Stream Muse data using Lab Streaming Layer (LSL) for research and BCI applications.

What is LSL?

Lab Streaming Layer (LSL) is a system for unified collection of time series data in research experiments. It's the standard for:

  • Neuroscience research
  • Brain-Computer Interface (BCI) development
  • Physiological data collection
  • Multi-modal data synchronization

LSL provides automatic time synchronization across multiple data streams and devices.

Enabling LSL Streaming

  1. Open SettingsOutput
  2. Find the LSL Streaming section
  3. Toggle Enable LSL
  4. Configure the stream name prefix (default: PetalMetrics)
Settings Persistence

Your LSL configuration is automatically saved and will be restored the next time you launch the app.

LSL Stream Names

Petal Metrics creates the following LSL outlets:

Stream NameTypeChannelsSample Rate
PetalMetrics_EEGEEG4 (TP9, AF7, AF8, TP10)256 Hz
PetalMetrics_AccelAccelerometer3 (X, Y, Z)52 Hz
PetalMetrics_GyroGyroscope3 (X, Y, Z)52 Hz
PetalMetrics_PPGPPG3 (Ambient, IR, Red)64 Hz

Stream names use your configured prefix. The defaults above assume the prefix PetalMetrics.

Example: Receiving in Python

from pylsl import StreamInlet, resolve_stream

# Find EEG stream
print("Looking for Muse EEG stream...")
streams = resolve_stream('name', 'PetalMetrics_EEG')
inlet = StreamInlet(streams[0])

print("Receiving EEG data...")
while True:
sample, timestamp = inlet.pull_sample()
tp9, af7, af8, tp10 = sample
print(f"[{timestamp:.3f}] TP9={tp9:.2f}, AF7={af7:.2f}, AF8={af8:.2f}, TP10={tp10:.2f}")

Example: Receiving in MATLAB

% Add LSL library to path
lib = lsl_loadlib();

% Find EEG stream
result = lsl_resolve_byprop(lib, 'name', 'PetalMetrics_EEG');
inlet = lsl_inlet(result{1});

% Receive data
while true
[sample, ts] = inlet.pull_sample();
fprintf('EEG: %.2f %.2f %.2f %.2f\n', sample(1), sample(2), sample(3), sample(4));
end

Example: Recording with LabRecorder

LabRecorder is a free tool for recording LSL streams:

  1. Download and run LabRecorder
  2. Enable LSL streaming in Petal Metrics
  3. Click Update in LabRecorder to find streams
  4. Select the Muse streams you want to record
  5. Click Start to begin recording to XDF format

Multi-Stream Synchronization

LSL automatically synchronizes timestamps across all streams. This is essential when:

  • Recording EEG alongside motion data
  • Combining Muse data with other LSL-compatible devices
  • Correlating brain activity with external events

Marker Streams

You can send event markers from your experiment software and they'll be time-synchronized with Muse data automatically.

Network Streaming

LSL streams are automatically discoverable on your local network. Other computers can find and receive your Muse streams without any additional configuration.

To restrict network access:

  • Configure your firewall to block LSL ports (default: 16571-16600)
  • Use LSL's built-in hostname restrictions

Performance Considerations

LSL adds minimal latency (~1ms typical) while providing:

  • Automatic clock synchronization
  • Network transparency
  • Robust data delivery

For lowest latency applications, ensure:

  • Both computers are on the same network segment
  • No heavy network traffic during streaming
  • Sufficient CPU resources for data processing

Troubleshooting

Stream not found

  • Verify LSL is enabled in Settings
  • Check that stream name prefix matches what you're searching for
  • Ensure both computers are on the same network
  • Try using resolve_stream('type', 'EEG') for broader search

Data gaps or dropouts

  • Check CPU usage - high load can cause drops
  • Reduce the number of receiving applications
  • Use a wired network connection

Time synchronization issues

  • Allow LSL to run for a few seconds before recording (synchronization improves over time)
  • Ensure NTP is working on both computers

Availability

LSL streaming is available on all subscription plans (Basic, Standard, Advanced).