示例#1
0
    def __init__(self, ip, rate):
        if rate == None:
            rate = 11025

        self.ip = ip
        self.rate = rate
        self.sdrrate = 32000
        self.fm = fmdemod.FMDemod(self.sdrrate)

        self.resampler = weakutil.Resampler(self.sdrrate, self.rate)

        self.sdr = sdrip.open(ip)
        self.sdr.setrate(self.sdrrate)
        #self.sdr.setgain(-10)

        # now weakcat.SDRIP.read() calls setrun().
        #self.sdr.setrun()

        self.starttime = None  # for faking a sample clock
        self.cardcount = 0  # for faking a sample clock

        self.bufbuf = []
        self.cardlock = threading.Lock()
        self.th = threading.Thread(target=lambda: self.sdr_thread())
        self.th.daemon = True
        self.th.start()

        # rate at which len(self.raw_read()) increases.
        self.rawrate = self.sdrrate
示例#2
0
    def __init__(self, card, chan, rate):
        self.use_oss = False
        #self.use_oss = ("freebsd" in sys.platform)
        self.card = card
        self.chan = chan

        # UNIX time of audio stream time zero.
        self.t0 = None

        if rate == None:
            rate = pya_input_rate(card, 8000)

        self.rate = rate  # the sample rate the app wants.
        self.cardrate = rate  # the rate at which the card is running.

        self.cardbufs = []
        self.cardlock = threading.Lock()

        self.last_adc_end = None
        self.last_end_time = None

        if self.use_oss:
            self.oss_open()
        else:
            self.pya_open()

        self.resampler = weakutil.Resampler(self.cardrate, self.rate)

        # rate at which len(self.raw_read()) increases.
        self.rawrate = self.cardrate
示例#3
0
    def __init__(self, dev, rate):
        if rate == None:
            rate = 11025

        self.rate = rate

        self.sdr = sdrplay.open(dev)
        self.sdrrate = self.sdr.getrate()

        self.resampler = weakutil.Resampler(self.sdrrate, self.rate)
示例#4
0
    def __init__(self, ip, rate):
        if rate == None:
            rate = 8000

        self.rate = rate

        self.time_mu = threading.Lock()
        self.cardtime = time.time() # UNIX time just after last sample in bufbuf

        self.sdr = eb200.open(ip)
        self.sdrrate = self.sdr.getrate()

        self.resampler = weakutil.Resampler(self.sdrrate, self.rate)
示例#5
0
    def __init__(self, ip, rate):
        if rate == None:
            rate = 11025

        self.rate = rate
        self.sdrrate = 8138

        self.bufbuf = [ ]
        self.starttime = time.time() # for faking a sample clock
        self.cardcount = 0 # for faking a sample clock
        self.cardlock = threading.Lock()

        self.resampler = weakutil.Resampler(self.sdrrate, self.rate)

        self.sdr = sdriq.open(ip)
        self.sdr.setrate(self.sdrrate)
        self.sdr.setgain(0)
        self.sdr.setifgain(18) # I don't know how to set this!
        self.sdr.setrun(True)

        self.th = threading.Thread(target=lambda : self.sdr_thread())
        self.th.daemon = True
        self.th.start()
示例#6
0
    def __init__(self, card, chan, rate):
        self.use_oss = ("freebsd" in sys.platform)
        self.card = card
        self.chan = chan

        if rate == None:
            rate = pya_input_rate(card, 8000)

        self.rate = rate # the sample rate the app wants.
        self.cardrate = rate # the rate at which the card is running.

        self.cardbufs = [ ]
        self.cardlock = threading.Lock()

        self.last_adc_end = None
        self.last_end_time = None

        if self.use_oss:
            self.oss_open()
        else:
            self.pya_open()

        self.resampler = weakutil.Resampler(self.cardrate, self.rate)