bsl.StreamPlayer#

class bsl.StreamPlayer(stream_name, fif_file, repeat=inf, trigger_def=None, chunk_size=16, high_resolution=False)#

Class for playing a recorded file on LSL network in another process.

Parameters
  • stream_name (str) – Stream’s server name, displayed on LSL network.

  • fif_file (file-like) – Path to the compatible raw .fif file to play.

  • repeat (int | float('inf')) – Number of times the stream player will loop on the FIF file before interrupting. Default float('inf') can be passed to never interrupt streaming.

  • trigger_def (None | file-like | TriggerDef) – If not None, a TriggerDef instance is used to log events with a descriptive string instead of their ID. If not None, either a TriggerDef instance or the path to a valid .ini file passed to TriggerDef.

  • chunk_size (int) – Number of samples to send at once (usually 16-32 is good enough).

  • high_resolution (bool) – If True, it uses perf_counter instead of sleep for higher time resolution. However, it uses more CPU.

Attributes
chunk_size

Number of samples to send at once (usually 16-32 is good enough) [samples].

fif_file

Path to the compatible raw .fif file to play.

high_resolution

If True, it uses perf_counter instead of sleep for higher time resolution.

process

Launched streaming process.

repeat

Number of times the stream player will loop on the FIF file before interrupting.

state

Streaming state of the player: - 0: Not streaming.

stream_name

Stream’s server name, displayed on LSL network.

trigger_def

Either None or TriggerDef instance converting event numbers into event strings.

Methods

start([blocking])

Start streaming data on LSL network in a new process.

stop()

Stop the streaming by terminating the process.

property chunk_size#

Number of samples to send at once (usually 16-32 is good enough) [samples].

Type

int

property fif_file#

Path to the compatible raw .fif file to play.

Type

str | Path

property high_resolution#

If True, it uses perf_counter instead of sleep for higher time resolution. However, it uses more CPU.

Type

bool

property process#

Launched streaming process.

Type

Process

property repeat#

Number of times the stream player will loop on the FIF file before interrupting. Default float('inf') can be passed to never interrupt streaming.

Type

int | float('ìnf')

start(blocking=True)#

Start streaming data on LSL network in a new process.

Parameters

blocking (bool) – If True, waits for the child process to start streaming data.

property state#
Streaming state of the player:
  • 0: Not streaming.

  • 1: Streaming.

Type

multiprocessing.Value

stop()#

Stop the streaming by terminating the process.

property stream_name#

Stream’s server name, displayed on LSL network.

Type

str

property trigger_def#

Either None or TriggerDef instance converting event numbers into event strings.

Type

TriggerDef