bsl.StreamPlayer¶
- class bsl.StreamPlayer(stream_name, fif_file, repeat=inf, trigger_def=None, chunk_size=16, high_resolution=False)[source]¶
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_filefile-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 notNone
, 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 usesperf_counter
instead ofsleep
for higher time resolution. However, it uses more CPU.
- stream_name
Attributes
Number of samples to send at once (usually
16-32
is good enough).Path to the compatible raw
.fif
file to play.If
True
, it usesperf_counter
instead ofsleep
.Launched streaming process.
Number of times the stream player will loop.
Streaming state of the player.
Stream's server name, displayed on LSL network.
Either
None
or TriggerDef instance.Methods
start
([blocking])Start streaming data on LSL network in a new process.
stop
()Stop the streaming by terminating the process.
- start(blocking=True)[source]¶
Start streaming data on LSL network in a new process.
- Parameters:
- blocking
bool
If
True
, waits for the child process to start streaming data.
- blocking
- property high_resolution¶
If
True
, it usesperf_counter
instead ofsleep
.- Type:
- property repeat¶
Number of times the stream player will loop.
Default
float('inf')
can be passed to never interrupt streaming.- Type:
int |
float('ìnf')
- property trigger_def¶
Either
None
or TriggerDef instance.Used to convert event numbers into event strings.
- Type:
Examples using bsl.StreamPlayer
¶
StreamPlayer: simulate an LSL stream
StreamRecorder: resting-state recording
StreamReceiver: real-time buffer filtered with a causal filter
StreamReceiver: real-time alpha band power