# Decimation of multiple streams

Hey guys,

I just had a quick question; if we have multiple streams that need to be
decimated, is there a fast way to go about doing that in GNURadio
Companion? How would you do it?

Here’s a picture of my flow graph: http://imgur.com/a/a0KCX

Best,
Ali

Hi Ali,

no, there’s no easy way to have N identical things in GRC.
However, I’m pretty sure you’re misusing vector_to_streamS.
There’s vector_to_streamS and vector_to_stream, and the second is what
you usually want when converting a vector to streams of samples.

Greetings,
Marcus

Hey Marcus,

So after some thought, I was able to figure out how to do the decimation
for multiple streams. I’m sure most of the gurus on this list already
know
how to do it, but just thought about sharing my 2 cents on how I
approached
it so that anybody who’s still having a similar difficulty can easily
solve
it.

So I basically used the concept of the hierarchy block and started off
with
a simple example where I had three streams passing through a constant
multiplier block. What I wanted to do was make the generation of these
blocks and connections dynamic for as many streams as I see want, so I
decided to adjust the python code generated from the hierarchy block,
and
it turned out to be a really simple fix. I simply added the following,
and
obviously deleted the redundant part of the code:

self.blocks_multiply_const_vxx = [0]*num_streams

for i in range(num_streams):
self.blocks_multiply_const_vxx[i] =
blocks.multiply_const_vff((2, ))
self.connect((self.blocks_multiply_const_vxx[i], 0), (self, i))
self.connect((self, i), (self.blocks_multiply_const_vxx[i], 0))

where num_streams is the number of streams I want. So just using this
simple idea, I was able to extend it to the decimation for multiple
streams. I’ve also taken some screenshots so that anyone who’s
interested
can see how I got about to do it: http://imgur.com/a/a0KCX

Best,
Ali

On Sat, Mar 7, 2015 at 3:11 AM, Marcus Müller [email protected]