Ejemplo n.º 1
0
Record a sample IQ.wav file from your RTLSDR or use the one provided in the samples flder.

'''

# Firstly we will have to import whatever libraries we would need
import os, sys
nb_dir = os.path.split(os.getcwd())[0]
if nb_dir not in sys.path:
    sys.path.append(nb_dir)

from directdemod import source, sink, chunker, comm, constants, filters, demod_am, demod_fm
import matplotlib.pyplot as plt

## First the source of data
fileName = "../samples/SDRSharp_20170830_073907Z_145825000Hz_IQ_autogain.wav"
sigsrc = source.IQwav(fileName)

## Next create a signal object, reading data from the source
# Read all values from the source into an array
sigArray = sigsrc.read(0, sigsrc.length)

# a commSignal object basically stores the signal array and its samplingrate
# if you want the array do sig.signal
# if you want the samping rate do sig.sampRate
sig = comm.commSignal(sigsrc.sampFreq, sigArray)

## Offset the frequency if required, not needed here
# sig.offsetFreq(0)

########### Apply a blackman harris filter to get rid of noise
bhFilter = filters.blackmanHarris(151)
Ejemplo n.º 2
0
        "number of starts/ends/outfilenames cannot be greater than frequencies given"
    )

# pad with defaults if starts/ends/outfilenames args are less than frequencies given
starts.extend([None] * (len(freqs) - len(starts)))
ends.extend([None] * (len(freqs) - len(ends)))
outs.extend([None] * (len(freqs) - len(outs)))
bandwidths.extend([None] * (len(freqs) - len(bandwidths)))

# input file name
fileName = args[0]

# create this as a signal source
sigsrc = None
if fileName[-3:] == "wav":
    sigsrc = source.IQwav(fileName, givenSampRate)
elif fileName[-3:] == "dat":
    sigsrc = source.IQdat(fileName, givenSampRate)
else:
    usage("Only .wav and .dat files are supported")

# report dictionary
reportDict = {}
reportDict['inFileName'] = fileName
reportDict['timeOfExec'] = strftime("%Y-%m-%d %H:%M:%S", gmtime())
reportDict['invIQ'] = '-q' in [i[0] for i in optlist]
reportDict['channels'] = []

for fileIndex in range(len(freqs)):
    try:
        # add entry to report