# Gettin data out from GRC to C++ or java?

**URL:** <https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565>\
**Category:** GNU Radio\
**Created:** [October 16, 2014, 8:58am UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565 "2014-10-16T08:58:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [October 16, 2014, 8:58am UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/1 "2014-10-16T08:58:21Z")

</div>

Greeting,

After building up some strong Matlab’s prototype of my 802.11 receiver,  
I  
have to make really big and complicated GUI with lot of button’s, plots,  
different tabs etc.

And my question is simple:

Any way to output complex data collected by USRP from grc to any other  
enviroment (c++ or java)?

Or it would be better practice to build receiver in grc and then  
plotting  
results out with UDP sink (already tried that, seems to be working)?

Best

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/Gettin-data-out-from-GRC-to-C-or-java-tp50824.html](http://gnuradio.4.n7.nabble.com/Gettin-data-out-from-GRC-to-C-or-java-tp50824.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![ernest\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/779978/32.png) [@ernest\_s](https://www.ruby-forum.com/u/ernest_s)\
**Post date:** [October 16, 2014, 9:26am UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/2 "2014-10-16T09:26:55Z")

</div>

Hi Ernest,

> Or it would be better practice to build receiver in grc and then  
> plotting results out with UDP sink (already tried that, seems to be  
> working)?  
> that’s a good question, and it depends on what you want to do, how much  
> stuff you’d have to port etc.

> Any way to output complex data collected by USRP from grc to any other  
> enviroment (c++ or java)?

GRC is “just” a graphical frontend for the creation of GNU Radio flow  
graphs.  
GNU Radio is mostly C++, with the possibility to do a lot of things in  
python. So that answers your C++ question.  
The “how to get data out of GNU Radio into XY?” question gets asked a  
lot, so there’s a FAQ entry for that:

[http://gnuradio.org/redmine/projects/gnuradio/wiki/FAQ#What-is-the-file-format-of-a-gr\_file\_sink-How-can-I-read-files-produced-by-a-file-sink](http://gnuradio.org/redmine/projects/gnuradio/wiki/FAQ#What-is-the-file-format-of-a-gr_file_sink-How-can-I-read-files-produced-by-a-file-sink)

In nearly all languages, you can just read the native data types from a  
file by using standard methods.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![ernest\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/779978/32.png) [@ernest\_s](https://www.ruby-forum.com/u/ernest_s)\
**Post date:** [October 16, 2014, 9:40am UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/3 "2014-10-16T09:40:36Z")

</div>

So i can just constantly write data to file (with file sink) and open it  
in a  
loop in any C++ enviroment right?

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/Gettin-data-out-from-GRC-to-C-or-java-tp50824p50826.html](http://gnuradio.4.n7.nabble.com/Gettin-data-out-from-GRC-to-C-or-java-tp50824p50826.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![ernest\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/779978/32.png) [@ernest\_s](https://www.ruby-forum.com/u/ernest_s)\
**Post date:** [October 16, 2014, 11:22am UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/4 "2014-10-16T11:22:21Z")

</div>

A pipe would probably be a better choice here, but yeah.

Or you build your own custom blocks to interface with your other code.

M

---

<div class="post-metadata">

**Author:** ![ernest\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/779978/32.png) [@ernest\_s](https://www.ruby-forum.com/u/ernest_s)\
**Post date:** [October 17, 2014, 12:43pm UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/5 "2014-10-17T12:43:43Z")

</div>

So i if would like to create a simple flow graph, with USRP source and  
file  
sink only, is there any way to control file buffer size (i.e i want that  
any  
file consist of 3k 32complex samples every write)?

Any 3.7 compatibile pipe pack? tried gr-pipe but typical “gnuradio-core”  
error ☹

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/Gettin-data-out-from-GRC-to-C-or-java-tp50824p50875.html](http://gnuradio.4.n7.nabble.com/Gettin-data-out-from-GRC-to-C-or-java-tp50824p50875.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![ernest\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/779978/32.png) [@ernest\_s](https://www.ruby-forum.com/u/ernest_s)\
**Post date:** [October 17, 2014, 2:16pm UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/6 "2014-10-17T14:16:35Z")

</div>

On 10/17/2014 12:40 PM, Ernest S. wrote:

> So i if would like to create a simple flow graph, with USRP source and file  
> sink only, is there any way to control file buffer size (i.e i want that any  
> file consist of 3k 32complex samples every write)?

You can’t control how many samples the USRP source will produce per run.  
And I’m not sure that’s really what you want.

> Any 3.7 compatibile pipe pack? tried gr-pipe but typical “gnuradio-core”  
> error ☹

I was suggesting you create a named pipe instead of a regular file. If  
you don’t know what that means, I suggest looking it up, it’s a basic  
concept of most OSes, and Google will have all the info you need.

You don’t need any addons for that.

M

---

<div class="post-metadata">

**Author:** ![ernest\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/779978/32.png) [@ernest\_s](https://www.ruby-forum.com/u/ernest_s)\
**Post date:** [October 17, 2014, 6:07pm UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/7 "2014-10-17T18:07:33Z")

</div>

* * *

Discuss-gnuradio mailing list  
removed\_email\_address@domain.invalid  
[https://lists.gnu.org/mailman/listinfo/discuss-gnuradio](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

---

<div class="post-metadata">

**Author:** ![ernest\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/779978/32.png) [@ernest\_s](https://www.ruby-forum.com/u/ernest_s)\
**Post date:** [October 17, 2014, 5:42pm UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/8 "2014-10-17T17:42:33Z")

</div>

Ernest - here’s an example of how to connect other stuff to GNU Radio  
via  
pipes - granted at much lower sample rates. Higher sample rates  
shouldn’t  
effect the pipe, but Matlab may not keep up with a typical 802.11 sample  
rate.

[![](https://img.youtube.com/vi/GBmli8Vflig/maxresdefault.jpg "How to connect GNU Radio receiver to multimon soft modem") ](https://www.youtube.com/watch?v=GBmli8Vflig)

If you _could_ get this 3k sample snapshot, how do you make sure a  
useful  
signal will be present?

If you’re doing processing in another framework, why don’t you just use  
UHD  
directly w/out GNU Radio? There are finite acquisition calls in UHD  
IIRC…

-John

On Fri, Oct 17, 2014 at 5:15 AM, Martin B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ernest\_s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/779978/32.png) [@ernest\_s](https://www.ruby-forum.com/u/ernest_s)\
**Post date:** [October 17, 2014, 10:08pm UTC](https://www.ruby-forum.com/t/gettin-data-out-from-grc-to-c-or-java/232565/9 "2014-10-17T22:08:05Z")

</div>

Thanks for those tips.

Matlab can handle 20M samples due to receiver object, which is buffering  
data, and than sending it to Matlab. My receiver is able to demodulate  
around 5x802.11 frames per second but i want something more faster.

So i can use UHD driver in C++ enviroment directly right? Sorry for  
newbie  
question, but im quite new to sdr platform 😃

Best

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/Gettin-data-out-from-GRC-to-C-or-java-tp50824p50898.html](http://gnuradio.4.n7.nabble.com/Gettin-data-out-from-GRC-to-C-or-java-tp50824p50898.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).
