Phasic← Overview

v0.2.2 · MIT · Rust · Drop-in liblsl

The Lab Streaming Layer, in Rust.

labstream speaks the wire protocol of sccn/liblsl (1.10) and exports all 165 C ABI symbols. Unchanged pylsl, LabRecorder, and C/C++ applications run on it—with negotiated extensions for shared-memory IPC, Wi-Fi dropout recovery, lossless compression, and lab network diagnostics.

Open live viewerView on GitHubcrates.ioPrebuilt liblsl

01Conformance

Measured against C++ liblsl, not guessed.

Every protocol rule in labstream is documented inSPEC.mdwith file-and-line citations to pinned C++ sccn/liblsl (e651023c), and verified by 508 tests plus a live conformance workbench.

165 / 165

C ABI symbols exported, none a stub

21 / 21

liblsl example programs link & agree

42 / 42

XPath queries match C++ oracle

2.0 µs

p50 local IPC via shm/1 (vs 592 µs TCP)

02Benchmarks & hardware

Built for real wireless amplifiers and lab Wi-Fi.

Bare-metal head-to-head benchmarks against C++ liblsl and an 8-hour overnight validation on a commercial Bluetooth EEG amplifier over a real LAN. Full methodology is indocs/benchmarks.md.

WorkloadlabstreamC++ liblslNotes
Local IPC (64 ch @ 1000 Hz)2.0 µs p50 (shm/1)592.0 µs p50 (TCP)Lock-free shared-memory ring
Lossy Wi-Fi (1% packet loss)20.1 ms p50 · 40.3 ms p99 (dgram/1)36.9 ms p50 · 74.3 ms p99 (TCP)UDP with selective retransmit
Live wireless EEG over LAN0.597× median wire ratio (comp/1)1.000× uncompressed40.3% bandwidth saved, bit-exact
8-hour live wireless soak5,964,230 samples · 0 gaps · 7.33 MB RSS—Clean recovery across 82 min post-battery dropout

03Protocol extensions

Opt-in extensions, zero breakage for standard peers.

Every extension negotiates during the LSL handshake. A standard liblsl peer ignores the offer and runs standard LSL 1.10 with zero changes. Phasic uses these extensions natively for live acquisition and XDF recording.

shm/1

Same-machine lock-free shared-memory ring (2.0 µs p50 local IPC).

dgram/1

UDP sample delivery with selective retransmit for lower tail latency on lossy Wi-Fi.

seq/1 + resume/1

Per-sample sequence numbers, gap reports, and RAM/disk store-and-forward recovery.

comp/1

Bit-exact lossless wire compression (adaptive Golomb-Rice delta coding, ~40% saved on live EEG).

select/1

Outlet-side channel subset and Hamming-sinc FIR decimation.

meta/1

In-band live metadata updates (e.g. hardware impedance) with zero reconnect.

enc/1

Opt-in transport encryption (X25519, HKDF-SHA256, ChaCha20-Poly1305).

SyncGroup

Real-time multi-stream Blackman-sinc resampler and aligner with explicit gap_mask.

ws + wasm

Opt-in RFC 6455 WebSocket bridge and 27 KB WebAssembly browser decoder.

labstream-cli

Standalone doctor, top, play, relay, and calibrate tools for lab networks.

04Quick start

Use it from Rust, Python, C/C++, or the terminal.

Rust crate

cargo add labstream

Idiomatic Rust API with block reads, channel lists, query builder, and optional no-socket protocol crates (labstream-core).

Drop-in for pylsl & C/C++

export PYLSL_LIB=/path/to/liblsl.so

Download prebuilt liblsl.so, liblsl.dylib, orlsl.dll fromGitHub Releases— no Rust toolchain needed.

CLI & browser bridge

labstream doctor
labstream top
labstream relay --ws-port 8765

Download the labstream CLI fromGitHub Releases(or build with cargo build --release -p labstream-cli) to diagnose lab networks or stream into the live browser viewer.