# I & Q samples in a source module

**URL:** <https://www.ruby-forum.com/t/i-q-samples-in-a-source-module/241893>\
**Category:** GNU Radio\
**Created:** [May 9, 2015, 6:43am UTC](https://www.ruby-forum.com/t/i-q-samples-in-a-source-module/241893 "2015-05-09T06:43:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [May 9, 2015, 6:43am UTC](https://www.ruby-forum.com/t/i-q-samples-in-a-source-module/241893/1 "2015-05-09T06:43:56Z")

</div>

My source modules has 16-bit I & Q samples that are interleaved:  
I,Q,I,Q,I,Q… as signed 16 bit values. I generate 512 pairs at a time  
in  
my work function (C++). I set noutput\_items to 512 and copy I and Q  
out  
512 times to the output\_items variable in the work function. Is this  
the  
correct format of data that subsequent modules can expect? I use the  
IShort\_to\_Complex module to convert the samples for subsequent modules.

Thanks,  
Y-

---

<div class="post-metadata">

**Author:** ![Yile\_Ku](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/77aa72/32.png) [@Yile\_Ku](https://www.ruby-forum.com/u/Yile_Ku)\
**Post date:** [May 9, 2015, 1:12pm UTC](https://www.ruby-forum.com/t/i-q-samples-in-a-source-module/241893/2 "2015-05-09T13:12:59Z")

</div>

Hi Y,

> I set noutput\_items to 512  
> no, noutput\_items is the maximum number you’re _allowed_ to produce, it  
> doesn’t change anything if you set it to anything. You just return the  
> number of items you’ve produced at the end of your work (or  
> general\_work) function. Make sure to not write more items than  
> noutput\_items allows you to do!

If you’re returning 512, this tells the scheduler you’ve produced 512  
_items_ – I don’t know what your block’s output signature looks like,  
but an item has the size of 2x 16bit, it’s right.

Best regards,  
Marcus

---

<div class="post-metadata">

**Author:** ![Yile\_Ku](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/77aa72/32.png) [@Yile\_Ku](https://www.ruby-forum.com/u/Yile_Ku)\
**Post date:** [May 10, 2015, 11:35am UTC](https://www.ruby-forum.com/t/i-q-samples-in-a-source-module/241893/3 "2015-05-10T11:35:36Z")

</div>

Y,

yes, if you’re producing 512 I+Q, you’re actually producing either 1024  
items of sizeof(unsigned short) or 512 items of sizeof(unsigned  
short)\*2.  
I’d like to repeat that you _must_ make sure that the number of items  
you write into your output buffer is ??? noutput\_items!  
What kind of block are you writing?

Best regards,  
Marcus
