I am using pyrtlsdr to read samples from an RTL-SDR. As in the example on the page, I am getting samples with sdr.read_samples(x).

The RTL-SDR returns 16 bits per sample: 8 bits for I, 8 bits for Q. The result of the read_samples function is a numpy array of type complex128 ("Complex number, represented by two 64-bit floats (real and imaginary components)"). This results in readings like (-0.0196078431373+0.00392156862745j).

What am I missing?

  • $\begingroup$ This question seems to have been asked in the correct place already: github.com/roger-/pyrtlsdr/issues/80 $\endgroup$ – MBaz Feb 24 '18 at 17:08
  • $\begingroup$ This software normalizes the samples to be withing the range [-1,1]. Have you examined multiple samples to verify that you only get 256 distinct values? $\endgroup$ – MBaz Feb 24 '18 at 17:10
  • $\begingroup$ @MBaz - why 128 bit complex type, though? $\endgroup$ – HH- Apologize to Carole Baskin Feb 24 '18 at 17:11
  • 2
    $\begingroup$ I don't know, but my guess would be that the software normalizes the samples to double-precision (64 bit) floats, and then packs them into a 128-bit complex. This is not an unusual practice. $\endgroup$ – MBaz Feb 24 '18 at 17:12
  • 2
    $\begingroup$ I'm glad it's useful, but I don't want to make it an answer because I'm just guessing. $\endgroup$ – MBaz Feb 24 '18 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.