I want to know what the sample rate of I and Q samples generated for transmission, in the function below from https://github.com/lyusupov/ADSB-Out/blob/master/ADSB_Encoder.py samples are generated for transmission by a SDR (HackRF) so they are aligned to 256k buffer (HackRF requirement) and then SDR (HackRF) commanded to send samples at the rate of 2 Ms/s. So without any hardware how can I save a stream of I and Q samples at a 2 Ms/s rate to be decoded by programs like dump1090.
def hackrf_raw_IQ_format(ppm):
signal = []
bits = numpy.unpackbits(numpy.asarray(ppm, dtype=numpy.uint8))
for bit in bits:
if bit == 1:
I = 127
Q = 127
else:
I = 0
Q = 0
signal.append(I)
signal.append(Q)
return bytearray(signal)
I want to save these samples at 2 Ms/s and later play by dump1090.
signal = []makes a list), twice, and then making a bytearray out of it; numpy can do all of this for you, much much much faster: the wholehackrf_raw_IQ_formatfunction could have four lines:bits = numpy.unpackbits(numpy.asarray(ppm, dtype=numpy.uint8)),signal = numpy.zeros((len(bits), 2), dtype=numpy.uint8),signal[bits == 1, :] = 127,return bytes(signal.flatten())– Marcus Müller Feb 13 '23 at 17:52