コード例 #1
0
ファイル: weakaudio.py プロジェクト: maksimus1210/weakmon
    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 ]
コード例 #2
0
ファイル: weakaudio.py プロジェクト: rtmrtmrtmrtm/weakmon
    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 ]
コード例 #3
0
ファイル: weakaudio.py プロジェクト: jbgreer/weakmon
    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]
コード例 #4
0
ファイル: weakaudio.py プロジェクト: rtmrtmrtmrtm/weakmon
    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 ]
コード例 #5
0
ファイル: weakaudio.py プロジェクト: jbgreer/weakmon
    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
コード例 #6
0
ファイル: weakaudio.py プロジェクト: jbgreer/weakmon
    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
コード例 #7
0
ファイル: weakaudio.py プロジェクト: maksimus1210/weakmon
    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 ]
コード例 #8
0
ファイル: weakaudio.py プロジェクト: rtmrtmrtmrtm/weakmon
    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 ]
コード例 #9
0
ファイル: sdrip.py プロジェクト: ve7it/weakmon
 def readusb(self):
     iq = self.readiq()
     usb = weakutil.iq2usb(iq)
     return usb
コード例 #10
0
ファイル: sdrip.py プロジェクト: rtmrtmrtmrtm/weakmon
 def readusb(self):
   iq = self.readiq()
   usb = weakutil.iq2usb(iq)
   return usb