Uncategorized

GNU Radio, the “Stream to Vector” block

In GNU Radio, the “Stream to Vector” block works with streamed sample data and groups it into fixed-length vectors.

Here’s a clear breakdown of how it works:


📡 Input Type

  • Stream of individual items (e.g. float, complex, short, byte — depending on how the upstream flowgraph is configured).
    • For example: float32 samples from an SDR, or complex64 baseband IQ samples.

🧱 Output Type

  • Vectors of fixed length (you specify the length in the block’s parameters).
    • If the vector length is N, then every N incoming scalar items are bundled into a single output vector of length N.
    • Output data type is the same as the input type, just in vector form (e.g. “complex vector”, “float vector”).

⚙️ Example

Say the input stream is:

[1, 2, 3, 4, 5, 6, 7, 8, ...]

and the vector length = 4.

The output will be:

[ [1, 2, 3, 4], [5, 6, 7, 8], ... ]

This is commonly used before:

  • FFT blocks (which expect vector inputs).
  • Correlators or filters that work on blocks of samples.
  • Custom processing where a chunk of samples is required together.

🧭 Practical Notes

  • If the number of incoming items is not divisible by the vector length, the last incomplete vector is held until more samples arrive.
  • No resampling or conversion is done — just repackaging.
  • If the vector length is too large for your buffer or processing block, it can stall or underflow.

Typical use case:
In radio astronomy or SDR work, for example, you might stream complex baseband data from SDRplay RSPduo, use Stream to Vector to create 2048-sample vectors, and then feed those to an FFT block for spectral analysis.

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.