Example #1
0
cutOff = 23.1  #cutoff frequency in rad/s
fs_lowpass = 188.495559  #sampling frequency in rad/s
order = 5  #order of filter

volume = 0.5  # range [0.0, 1.0]
fs = 44100  # sampling rate, Hz, must be integer
duration = 5  # in seconds, may be float
f_sin = 1000  # sine frequency, Hz, may be float

info = StreamInfo('BioSemi', 'EEG', 1, 4096, 'float32', 'myuid34234')

outlet = StreamOutlet(info)

p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')
for i in range(0, numdevices):
    if (p.get_device_info_by_host_api_device_index(
            0, i).get('maxInputChannels')) > 0:
        print("Input Device id ", i, " - ",
              p.get_device_info_by_host_api_device_index(0, i).get('name'))

calibrate_times = 5
avg_15 = 0
avg_10 = 0
print("now sending data...")
while True:
    # make a new random 8-channel sample; this is converted into a
    # pylsl.vectorf (the data type that is expected by push_sample)
    # now send it and wait for a bit