discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] question on using gr.file_source


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] question on using gr.file_source
Date: Mon, 14 Jan 2008 07:49:50 -0800
User-agent: Mutt/1.5.17 (2007-11-01)

On Mon, Jan 14, 2008 at 05:51:19PM +0800, Jason Anders wrote:
> Yeah, unfortunately it didn't answer my question. =(
> 
> What I would've wanted is to superimpose data from two inputs so that they
> can be combined into a single stream.
> 
> For example; let's say that there are two sources src0 and src1, and let's
> say that I extracted inputs from two files "input1.dat" and "input2.dat" to
> src0 and src1 respectively. I wanted to implement something that takes one
> sample from src0 then the next sample from source 1 just like this:
> 
> variable[0] = src0[0]
> variable[1] = src1[0]
> 
> variable[2] = src0[1]
> variable[3] = src1[1]
> 
> and so on and so forth. In the end "variable" would have values from both
> src0 and src1 and whose length is the sum of the lengths of src0 and src1.
> 
> I would like to know if this is possible. Thanks!


Yes, we've got a block that'll do that for you, gr.interleave.
(We've also got the inverse, gr.deinterleave)


  src0 = ...
  src1 = ...
  interleave = gr.interleave(gr.sizeof_<items_in_src0_and_src1>)  # E.g., 
gr.sizeof_float
  
  downstream = ... # your downstream block...

  fg.connect(src0, (interleave, 0))
  fg.connect(src1, (interleave, 1))
  fg.connect(interleave, downstream)

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]