コード例 #1
0
    def __init__(self, bitDepth, numberOfChannels, sampleRate, bitsPerSymbol,
                 samplesPerSymbol, carrierFrequency, outputFileName,
                 firstStopband, firstPassband, secondPassband, secondStopband,
                 passbandAttenuation, stopbandAttenuation, polynomialDegree,
                 firstGenerator, secondGenerator, firstInitialValue,
                 secondInitialValue, samplesPerChip, filter, writeOutput):

        FilterTransmitter.__init__(
            self, bitDepth, numberOfChannels, sampleRate, bitsPerSymbol,
            samplesPerSymbol, carrierFrequency, outputFileName, firstStopband,
            firstPassband, secondPassband, secondStopband, passbandAttenuation,
            stopbandAttenuation, writeOutput)

        self.polynomialDegree = polynomialDegree
        self.firstGenerator = firstGenerator
        self.secondGenerator = secondGenerator
        self.firstInitialValue = firstInitialValue
        self.secondInitialValue = secondInitialValue
        self.samplesPerChip = samplesPerChip

        self.inphaseSpreadingCode = \
          python_initialize_gold_code (
            self.polynomialDegree, self.firstGenerator, self.secondGenerator,
            self.firstInitialValue, self.secondInitialValue
                                      )

        self.quadratureSpreadingCode = \
          python_initialize_gold_code (
            self.polynomialDegree, self.firstGenerator, self.secondGenerator,
            self.firstInitialValue, self.secondInitialValue
                                      )

        self.applyFilter = filter
コード例 #2
0
ファイル: cpaudio.py プロジェクト: ProjectDBD/CPAudio
def filterTransmit():
  if( args.message and args.deviceName ):
    print "Transmit info:"
    print "\tMessage:\t\t'%s'" %( args.message )
    print "\tDevice:\t\t\t%s" %( args.deviceName )
    print "\tOutput signal:\t\t%s" %( "Yes" if( args.writeOutput ) else "No" )
    print "\nFormat info:"
    print "\tBit depth:\t\t%d" %( args.bitDepth )
    print "\tNumber of channels:\t%d" %( args.numberOfChannels )
    print "\tSample rate:\t\t%.02f" %( args.sampleRate )
    print "\nModulation info:"
    print "\tBits per symbol:\t%d" %( args.bitsPerSymbol )
    print "\tSamples per symbol:\t%d" %( args.samplesPerSymbol )
    print "\tCarrier frequency:\t%.02f" %( args.carrierFrequency )
    print "\nFilter info:"
    print "\tFirst stopband:\t\t%.02f" %( args.widebandFirstStopband )
    print "\tFirst passband:\t\t%.02f" %( args.widebandFirstPassband )
    print "\tSecond passband:\t%.02f" %( args.widebandSecondPassband )
    print "\tSecond stopband:\t%.02f" %( args.widebandSecondStopband )
    print "\tPassband attenuation:\t%.02f" %( args.passbandAttenuation )
    print "\tStopband attenuation:\t%.02f" %( args.stopbandAttenuation )

    if( args.filter ):
      print "WARN: Filter flag set for filterTransmit. Redundant option set."

    if( args.writeOutput ):
      print "\nOutput info:"
      print "\tFile name:\t\t%s" %( args.outputFileName )

    device = findDevice( args.deviceName )

    if( device ):
      if( device.doesSupportPlayback() ):
        transmitter = \
          FilterTransmitter (
            args.bitDepth,
            args.numberOfChannels,
            args.sampleRate,
            args.bitsPerSymbol,
            args.samplesPerSymbol,
            args.carrierFrequency,
            args.outputFileName,
            args.widebandFirstStopband,
            args.widebandFirstPassband,
            args.widebandSecondPassband,
            args.widebandSecondStopband,
            args.passbandAttenuation,
            args.stopbandAttenuation,
            args.writeOutput
                      )

        transmitter.transmit( device, args.message )
      else:
        print "ERROR: Device %s does not support playback." \
          %( args.deviceName )
    else:
      print "ERROR: Could not find device %s." %( args.deviceName )
  else:
    print "ERROR: Message and device name must be set for transmit."
コード例 #3
0
  def __init__  (
    self, bitDepth, numberOfChannels, sampleRate, bitsPerSymbol,
    samplesPerSymbol, carrierFrequency, outputFileName, firstStopband,
    firstPassband, secondPassband, secondStopband, passbandAttenuation,
    stopbandAttenuation, polynomialDegree, firstGenerator, secondGenerator,
    firstInitialValue, secondInitialValue, samplesPerChip, filter, writeOutput
                ):

    FilterTransmitter.__init__  (
      self, bitDepth, numberOfChannels, sampleRate,
      bitsPerSymbol, samplesPerSymbol, carrierFrequency,
      outputFileName, firstStopband, firstPassband, secondPassband,
      secondStopband, passbandAttenuation, stopbandAttenuation,
      writeOutput
                          )

    self.polynomialDegree   = polynomialDegree
    self.firstGenerator     = firstGenerator
    self.secondGenerator    = secondGenerator
    self.firstInitialValue  = firstInitialValue
    self.secondInitialValue = secondInitialValue
    self.samplesPerChip     = samplesPerChip

    self.inphaseSpreadingCode = \
      python_initialize_gold_code (
        self.polynomialDegree, self.firstGenerator, self.secondGenerator,
        self.firstInitialValue, self.secondInitialValue
                                  )

    self.quadratureSpreadingCode = \
      python_initialize_gold_code (
        self.polynomialDegree, self.firstGenerator, self.secondGenerator,
        self.firstInitialValue, self.secondInitialValue
                                  )

    self.applyFilter = filter
コード例 #4
0
    def __del__(self):
        FilterTransmitter.__del__(self)

        csignal_destroy_gold_code(self.inphaseSpreadingCode)
        csignal_destroy_gold_code(self.quadratureSpreadingCode)
コード例 #5
0
  def __del__( self ):
    FilterTransmitter.__del__( self )

    csignal_destroy_gold_code( self.inphaseSpreadingCode )
    csignal_destroy_gold_code( self.quadratureSpreadingCode )