Phasic← Overview

Live and streaming

Opened by:  Connect LSL in the toolbar, or "LSL visualizer" on the welcome screen
Requires:   `lsl` feature (enabled by default); audio monitoring also needs `audio`
Applies to: all channel kinds

Phasic can ingest live streams over Lab Streaming Layer and display them as they arrive, with the same processing chain a file gets — montage, filters, ASR, spectral views.

Phasic ingests but does not transmit. There is no LSL outlet and no closed-loop control; those were considered and deliberately dropped as out of scope. See About.

The lsl feature is enabled by default (and included in all prebuilt release binaries). To build an offline-only viewer with no network sockets, pass --no-default-features.

No C library is needed. The transport is a pure-Rust LSL implementation (labstream) — an ordinary dependency with nothing to install or locate. It supports SHM / UDP / TCP, resume/1 dropout recovery, select/1 channel and rate selection, meta/1 live metadata and hardware impedance reporting, optional enc/1 transport encryption, and built-in doctor network diagnostics.

Sessions

A session is several streams captured together onto one clock, recorded into one XDF file.

Sessions grow by additive join: connecting a second stream appends it to the running session rather than starting a rival one. The first stream is the anchor — it resolves the shared marker stream, and its first sample defines time zero for everything.

Each stream gets its own pane, and each keeps its own sample rate. Nothing is resampled to match anything else.

Use Link in a stream’s control bar to synchronise pan and zoom across the session’s panes.

What is kept in memory

Only the most recent 5 minutes of each stream is held in RAM. The full recording spools continuously to disk.

Scrolling back beyond the retained window shows a flat line rather than an error — the data is in the file, not in memory. To review earlier material, stop the session and reopen the recording.

This is what makes an indefinitely long session possible: memory use is bounded by the retention window, not by session length.

Recording

Live streams are visualized without writing to disk until you click Record in the live control bar. While recording, everything received is spooled continuously to a single XDF file as it arrives.

The file is complete at every moment. There is no finalisation step, so an interrupted session — a crash, a power loss — leaves a readable recording of everything up to that point. Streams may start and stop independently while the file continues.

When you click Stop rec, Phasic prompts for a save location off-thread, saves the XDF file, and reopens it as an ordinary recording so you move directly from monitoring to analysis.

See XDF for what the written file contains — in particular that Phasic deliberately writes no clock-offset chunks, because its inputs are already corrected as they arrive.

Encrypted streams (enc/1)

In the Connect live stream browser, you can configure optional labstream enc/1 transport encryption:

  • Off (default) — standard unencrypted LSL connections.
  • Opportunistic — encrypts when the outlet supports enc/1, otherwise connects unencrypted.
  • Required — refuses unencrypted outlets.

Enter a pre-shared key (masked field) when connecting to outlets configured with a PSK.

Live processing

A live stream is a signal source like any other, so the ordinary processing chain applies — montage, filters, envelopes, spectral views.

Two differences from a file:

Filters run causally. A single forward pass, introducing the filter’s phase delay, because the backward pass of zero-phase filtering needs samples that have not arrived. See Filters.

ASR must be calibrated first. It learns a covariance model from a clean stretch before it can clean anything. Calibrate on an artifact-free period, then enable it.

Monitoring what you are receiving

The live control bar reports more than sample count, and it is worth watching:

Readout Meaning
Throughput Measured rate. Turns red when it drifts more than 10% from nominal
Lost samples Hidden when zero
Signal quality · N poor, with per-channel reasons on hover

A measured rate drifting from nominal usually means the source is struggling, and is the earliest warning available.

Audio monitoring

A stream carrying audio can be played through the speakers while it is plotted, with a level meter, clip indicator and volume control.

This needs the audio feature, which links the system audio library at build time — the one optional feature with a build-time system dependency. Without it, the audio controls are absent.

Playback stays a fixed latency behind the write head and resamples to the sound card’s rate. It is best-effort throughout: any problem produces silence rather than a stall.

Testing without hardware

scripts/mock_lsl_stream.py emits synthetic EEG and marker streams, so the live path can be exercised with no device.

It is built for testing ASR specifically: the first 60 seconds are kept clean so ASR can calibrate on an uncontaminated baseline, after which it injects the artifacts ASR is meant to remove — frontal eye-blinks, lateral EMG bursts and single-channel electrode pops.