import liblsl import random import time # first create a new stream info (here we set the name to BioSemi, the content-type to EEG, 8 channels, 100 Hz, and float-valued data) # The last value would be the serial number of the device or some other more or less locally unique identifier for the stream as far as available (you could also omit it but interrupted connections wouldn't auto-recover). info = liblsl.stream_info('BioSemi','EEG',8,100,liblsl.cf_float32,'dsffwerwer'); # next make an outlet outlet = liblsl.stream_outlet(info) print("now sending data...") while True: # make a new random 8-channel sample; this is converted into a liblsl.vectorf (the data type that is expected by push_sample) mysample = liblsl.vectorf([random.random(),random.random(),random.random(),random.random(),random.random(),random.random(),random.random(),random.random()]) # now send it and wait for a bit outlet.push_sample(mysample) time.sleep(0.01)
import liblsl # first resolve an EEG stream on the lab network print("looking for an EEG stream...") streams = liblsl.resolve_stream('type','EEG') # create a new inlet to read from the stream inlet = liblsl.stream_inlet(streams[0]) sample = liblsl.vectorf() while True: # get a new sample (you can also omit the timestamp part if you're not interested in it) timestamp = inlet.pull_sample(sample) print(timestamp, list(sample))
import liblsl import random import time # first create a new stream info (here we set the name to BioSemi, the content-type to EEG, 8 channels, 100 Hz, and float-valued data) # The last value would be the serial number of the device or some other more or less locally unique identifier for the stream as far as available (you could also omit it but interrupted connections wouldn't auto-recover). info = liblsl.stream_info('BioSemi', 'EEG', 8, 100, liblsl.cf_float32, 'dsffwerwer') # next make an outlet outlet = liblsl.stream_outlet(info) print("now sending data...") while True: # make a new random 8-channel sample; this is converted into a liblsl.vectorf (the data type that is expected by push_sample) mysample = liblsl.vectorf([ random.random(), random.random(), random.random(), random.random(), random.random(), random.random(), random.random(), random.random() ]) # now send it and wait for a bit outlet.push_sample(mysample) time.sleep(0.01)