def Initialize(self, indim, outdim): self.warp = 1000.0 # let the samples flowing into the ring buffer set the pace self.eegfs = self.samplingrate() self.hwfs = int(self.params['HardwareSamplingRate']) self.chunk = SigTools.msec2samples( float(self.params['HardwareChunkMsec']), self.hwfs) ringsize = SigTools.msec2samples( float(self.params['NIABufferSizeMsec']), self.hwfs) self.ring = SigTools.ring(ringsize, indim[0]) self.ring.allow_overflow = True self.nominal['HardwareSamplesPerPacket'] = SigTools.msec2samples( self.nominal['SecondsPerPacket'] * 1000.0, self.hwfs) cutoff = float(self.params['DSFilterFreqFactor']) * self.eegfs / 2.0 order = int(self.params['DSFilterOrder']) if order > 0 and cutoff > 0.0: self.filter = SigTools.causalfilter( freq_hz=cutoff, samplingfreq_hz=self.hwfs, order=order, type='lowpass') #, method=SigTools.firdesign) else: self.filter = None self.dsind = numpy.linspace(0.0, self.nominal['HardwareSamplesPerPacket'], self.nominal['SamplesPerPacket'] + 1, endpoint=True) self.dsind = numpy.round(self.dsind).astype(numpy.int).tolist() self._threads['listen'].post('start') self._threads['listen'].read('ready', wait=True, remove=True) self._check_threads()
def Initialize(self, indim, outdim): self.warp = 1000.0 # let the audio samples flowing into the ring buffer set the pace self.eegfs = self.samplingrate() self.audiofs = int(self.params['AudioSamplingRate']) self.audiobits = int(self.params['AudioBitDepth']) self.audiochunk = WavTools.msec2samples(float(self.params['AudioChunkMsec']), self.audiofs) self.audiochannels = int(self.params['NumberOfAudioChannels']) self.use_env = int(self.params['UseAudioEnvelope']) ringsize = WavTools.msec2samples(float(self.params['AudioBufferSizeMsec']), self.audiofs) self.ring = SigTools.ring(ringsize, self.audiochannels) self.ring.allow_overflow = True self.nominal['AudioSamplesPerPacket'] = WavTools.msec2samples(self.nominal['SecondsPerPacket']*1000.0, self.audiofs) self.dsind = numpy.linspace(0.0, self.nominal['AudioSamplesPerPacket'], self.nominal['SamplesPerPacket']+1, endpoint=True) self.dsind = numpy.round(self.dsind).astype(numpy.int).tolist() self._threads['listen'].post('start') self._threads['listen'].read('ready', wait=True, remove=True) self._check_threads()
def Initialize(self, indim, outdim): self.warp = 1000.0 # let the samples flowing into the ring buffer set the pace self.eegfs = self.samplingrate() self.hwfs = int(self.params['HardwareSamplingRate']) self.chunk = SigTools.msec2samples(float(self.params['HardwareChunkMsec']), self.hwfs) ringsize = SigTools.msec2samples(float(self.params['NIABufferSizeMsec']), self.hwfs) self.ring = SigTools.ring(ringsize, indim[0]) self.ring.allow_overflow = True self.nominal['HardwareSamplesPerPacket'] = SigTools.msec2samples(self.nominal['SecondsPerPacket']*1000.0, self.hwfs) cutoff = float(self.params['DSFilterFreqFactor']) * self.eegfs / 2.0 order = int(self.params['DSFilterOrder']) if order > 0 and cutoff > 0.0: self.filter = SigTools.causalfilter(freq_hz=cutoff, samplingfreq_hz=self.hwfs, order=order, type='lowpass') #, method=SigTools.firdesign) else: self.filter = None self.dsind = numpy.linspace(0.0, self.nominal['HardwareSamplesPerPacket'], self.nominal['SamplesPerPacket']+1, endpoint=True) self.dsind = numpy.round(self.dsind).astype(numpy.int).tolist() self._threads['listen'].post('start') self._threads['listen'].read('ready', wait=True, remove=True) self._check_threads()
def Initialize(self, indim, outdim): self.warp = 1000.0 # let the audio samples flowing into the ring buffer set the pace self.eegfs = self.samplingrate() self.audiofs = int(self.params['AudioSamplingRate']) self.audiobits = int(self.params['AudioBitDepth']) self.audiochunk = WavTools.msec2samples( float(self.params['AudioChunkMsec']), self.audiofs) self.audiochannels = int(self.params['NumberOfAudioChannels']) self.use_env = int(self.params['UseAudioEnvelope']) ringsize = WavTools.msec2samples( float(self.params['AudioBufferSizeMsec']), self.audiofs) self.ring = SigTools.ring(ringsize, self.audiochannels) self.ring.allow_overflow = True self.nominal['AudioSamplesPerPacket'] = WavTools.msec2samples( self.nominal['SecondsPerPacket'] * 1000.0, self.audiofs) self.dsind = numpy.linspace(0.0, self.nominal['AudioSamplesPerPacket'], self.nominal['SamplesPerPacket'] + 1, endpoint=True) self.dsind = numpy.round(self.dsind).astype(numpy.int).tolist() self._threads['listen'].post('start') self._threads['listen'].read('ready', wait=True, remove=True) self._check_threads()