Skip to content

Instantly share code, notes, and snippets.

@kbeckmann
Created May 19, 2019 19:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save kbeckmann/6db25501ff02c46e79143c0ed1c47d88 to your computer and use it in GitHub Desktop.
Save kbeckmann/6db25501ff02c46e79143c0ed1c47d88 to your computer and use it in GitHub Desktop.
Convert RAW iq samples to SDRAngel "sdriq" format
import sys
import struct
import binascii
# See https://github.com/f4exb/sdrangel/tree/master/plugins/samplesource/filesource
data = open(sys.argv[1], "rb").read()
out = open(sys.argv[2], "wb")
w = bytearray()
w += struct.pack("<I", 500000) # Sample rate
w += struct.pack("<Q", 868000000) # Center freq Hz
w += struct.pack("<Q", 0) # Timestamp
w += struct.pack("<I", 16) # Sample size 16 or 24 ?
w += struct.pack("<I", 0) # Padding
out.write(w)
out.write(struct.pack("<I", binascii.crc32(w))) # CRC32
out.write(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment