1+ """Example program to demonstrate how to read a multi-channel time-series
2+ from LSL in a chunk-by-chunk manner (which is more efficient).
3+
4+ Please restart this script if you change one of the data types.
5+ Also, the # Chan should match the data type (Examples: 1 for Focus, 3 for Accel)
6+
7+ """
8+
9+ from pylsl import StreamInlet , resolve_stream
10+
11+ numStreams = 3
12+ # first resolve an EEG stream on the lab network
13+ print ("looking for an EEG stream..." )
14+ stream1 = resolve_stream ('name' , 'obci_eeg1' )
15+ stream2 = resolve_stream ('name' , 'obci_eeg2' )
16+ stream3 = resolve_stream ('name' , 'obci_eeg3' )
17+
18+ # create a new inlet to read from the stream
19+ inlet = StreamInlet (stream1 [0 ])
20+ inlet2 = StreamInlet (stream2 [0 ])
21+ inlet3 = StreamInlet (stream3 [0 ])
22+
23+ while True :
24+ for i in range (numStreams ):
25+ # get a new sample (you can also omit the timestamp part if you're not
26+ # interested in it)
27+ if i == 0 :
28+ chunk , timestamps = inlet .pull_chunk ()
29+ if timestamps :
30+ print ("Stream" , i + 1 , " == " , chunk )
31+ elif i == 1 :
32+ chunk , timestamps = inlet2 .pull_chunk ()
33+ if timestamps :
34+ print ("Stream" , i + 1 , " == " , chunk )
35+ elif i == 2 :
36+ chunk , timestamps = inlet3 .pull_chunk ()
37+ if timestamps :
38+ print ("Stream" , i + 1 , " == " , chunk )
0 commit comments