Uncategorized

GNU Radio standard ways to save raw or processed data streams from an SDR

In GNU Radio you’ve got a few standard ways to save raw or processed data streams from an SDR (like your RTL-SDR or RSPduo) directly from a flowgraph or a Python script. The main blocks are:


1. File Sink (basic, but powerful)

  • Block name: File Sink
  • What it does: Saves any stream (complex, float, int, byte) to a binary file.
  • Use when: You want to capture raw IQ samples or intermediate data to disk.
  • Notes:
    • The output file has no headers/metadata, just raw interleaved samples.
    • Useful for later offline analysis with GNU Radio, Python, or tools like csdr, inspectrum, etc.
    • Match the sample type (complex64, float32, etc.) with your stream.

2. File Meta Sink (adds metadata)

  • Block name: File Meta Sink
  • What it does: Like File Sink, but writes a metadata header (JSON) describing sample rate, type, start time, etc.
  • Use when: You want reproducibility and easier re-loading into GNU Radio or Python without guessing sample format.
  • File extension: Often .cfile or .meta associated.

3. Wave File Sink

  • Block name: Wav File Sink
  • What it does: Saves float or short samples as a .wav audio file.
  • Use when: You’re down-converting to audio (e.g., demodulated signals, narrowband listening).
  • Limit: Only works well for sample rates ≤ 192 kHz.

4. Stream to Vector → File Sink

  • Combo block: Stream to Vector + File Sink
  • What it does: Groups samples into fixed-size vectors before saving.
  • Use when: You want data in matrix-like form (e.g., for FFTs or ML pipelines).

5. Python Snippet (in OOT module or embedded Python block)

  • Block name: Embedded Python Block
  • What it does: Lets you write custom logic to save/stream data.
  • Example: You can push samples into a .npy file using NumPy, or send them over a socket for real-time analysis.

💡 Typical setup for IQ capture from RTL-SDR:

[RTL-SDR Source] → [Throttle] → [File Sink (Complex)]

This will save raw interleaved IQ samples (complex float32).

If you want metadata:

[RTL-SDR Source] → [Throttle] → [File Meta Sink]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.