def read(self): # delay setrun() until the last moment, so that # all other parameters have likely been set. if self.sdr.running == False: self.sdr.setrun() self.cardlock.acquire() bufbuf = self.bufbuf cardcount = self.cardcount self.bufbuf = [ ] self.cardlock.release() buf_time = self.starttime + cardcount / float(self.sdrrate) if len(bufbuf) == 0: return [ numpy.array([]), buf_time ] buf1 = numpy.concatenate(bufbuf) # XXX maybe should be moved to sdrip.py? if self.sdr.mode == "usb": buf2 = weakutil.iq2usb(buf1) # I/Q -> USB elif self.sdr.mode == "fm": [ buf2, junk ] = self.fm.demod(buf1) # I/Q -> FM else: sys.stderr.write("weakaudio: SDRIP unknown mode %s\n" % (self.sdr.mode)) sys.exit(1) buf3 = self.resampler.resample(buf2) buf4 = buf3.astype(numpy.float32) # save some space. return [ buf4, buf_time ]
def read(self): [buf, buf_time] = self.sdr.readiq() buf = weakutil.iq2usb(buf) # I/Q -> USB buf = self.resampler.resample(buf) return [buf, buf_time]
def read(self): [ buf, buf_time ] = self.sdr.readiq() buf = weakutil.iq2usb(buf) # I/Q -> USB buf = self.resampler.resample(buf) return [ buf, buf_time ]
def postprocess(self, buf1): if len(buf1) == 0: return numpy.array([]) buf = weakutil.iq2usb(buf1) # I/Q -> USB buf = self.resampler.resample(buf) # no matter how I set its RF or IF gain, # the SDR-IQ generates peaks around 145000, # or I and Q values of 65535. cut this down # so application doesn't think the SDR-IQ is clipping. buf = buf / 10.0 return buf
def postprocess(self, buf1): if len(buf1) == 0: return numpy.array([]) if self.sdr.mode == "usb": buf2 = weakutil.iq2usb(buf1) # I/Q -> USB elif self.sdr.mode == "fm": [buf2, junk] = self.fm.demod(buf1) # I/Q -> FM else: sys.stderr.write("weakaudio: SDRIP unknown mode %s\n" % (self.sdr.mode)) sys.exit(1) buf3 = self.resampler.resample(buf2) return buf3
def read(self): self.cardlock.acquire() bufbuf = self.bufbuf cardcount = self.cardcount self.bufbuf = [ ] self.cardlock.release() buf_time = self.starttime + cardcount / float(self.sdrrate) if len(bufbuf) == 0: return [ numpy.array([]), buf_time ] buf = numpy.concatenate(bufbuf) buf = weakutil.iq2usb(buf) # I/Q -> USB buf = self.resampler.resample(buf) # no matter how I set its RF or IF gain, # the SDR-IQ generates peaks around 145000, # or I and Q values of 65535. cut this down # so application doesn't think the SDR-IQ is clipping. buf = buf / 10.0 return [ buf, buf_time ]
def readusb(self): iq = self.readiq() usb = weakutil.iq2usb(iq) return usb