# Separate samples from 2 receive channels

**URL:** <https://www.ruby-forum.com/t/separate-samples-from-2-receive-channels/224298>\
**Category:** GNU Radio\
**Created:** [November 7, 2012, 8:16am UTC](https://www.ruby-forum.com/t/separate-samples-from-2-receive-channels/224298 "2012-11-07T08:16:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 7, 2012, 8:16am UTC](https://www.ruby-forum.com/t/separate-samples-from-2-receive-channels/224298/1 "2012-11-07T08:16:38Z")

</div>

Hi, All,

Can I use one USRP1 and two WBX daughterboards to create 2 concurrent  
complex receive channels so that I can compare them?  
If I use the rx\_multi\_samples.cpp example in uhd to receive samples from  
2 channels (–subdev=“A:0 B:0”), and add several lines from  
rx\_samples\_to\_file.cpp like

outfile.write((const char\*)&buff.front(),  
num\_rx\_samps\*sizeof(samp\_type));  
to record samples in a file, how can I tell which channel a sample is  
from?  
Because we have 2 complex receive channels, so the sample order is I\_0,  
Q\_0, I\_1, Q\_1, I\_0, Q\_0, I\_1, Q\_1 … Is this correct?  
If I read the binary file as complex numbers, then odd complex samples  
are from channel 0 and even complex samples are from channel 1.  
Is my assumption correct?

Thanks,  
Pei

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 7, 2012, 6:56pm UTC](https://www.ruby-forum.com/t/separate-samples-from-2-receive-channels/224298/2 "2012-11-07T18:56:25Z")

</div>

On 11/06/2012 11:15 PM, Dekst wrote:

> 

You might want to look at rx\_multi\_samples.cpp as an example of a  
streamer w/ multiple channels. Basically, the recv() call will fill 2  
buffers in this case, not one. In other words, the data is not  
interleaved.

I also recommend using the gnuradio companion. You can make a simple  
flow graph with a USRP source with two output stream and simply connect  
2 file sinks.

-josh
