# File sink

**URL:** <https://www.ruby-forum.com/t/file-sink/246134>\
**Category:** GNU Radio\
**Created:** [September 1, 2013, 8:52pm UTC](https://www.ruby-forum.com/t/file-sink/246134 "2013-09-01T20:52:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [September 1, 2013, 8:52pm UTC](https://www.ruby-forum.com/t/file-sink/246134/1 "2013-09-01T20:52:36Z")

</div>

I have an application where I observe real time display of some bands.  
What I  
want to do is make a FIFO/Buffer where the data can be stored  
simultaneously  
and with a push button ‘rewind’ I can access the immediate past 15 sec  
data.

So basically I want to know how to make a such file sink, which can  
store  
just immediate past 15 sec data.

gr\_file\_sink keeps increasing the size while gr\_head stops after taking  
a  
fixed number of samples.

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/File-sink-tp43431.html](http://gnuradio.4.n7.nabble.com/File-sink-tp43431.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![sumitstop](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@sumitstop](https://www.ruby-forum.com/u/sumitstop)\
**Post date:** [September 2, 2013, 1:58am UTC](https://www.ruby-forum.com/t/file-sink/246134/2 "2013-09-02T01:58:42Z")

</div>

Hello Sumit Kurmar,

this depends on what you want to do with your data, the data rate, and  
the amount of effort your willing to make.

- Easiest solution: Use the “delay” block with a delay of (sample rate)

- 15s. Advantage: Yields a GNU Radio sample stream that’s delayed by  
15s. Drawback: This can be a _large_ amount of samples, so this might  
actually fail if GNU Radio is not able to allocate a shared buffer  
that’s big enough to hold them; there are ways around that, anyways.

- Versatile solution: Write your own signal processing block. It’s  
really a simple exercise when done in python or in C++, whatever is the  
language of your choice.  
Just implement a ring buffer of length (sample rate)\*15s by keeping an  
input counter that increments (mod length) whenever you copy input  
samples to the internal buffer, and either write a method that returns a  
(linear) copy of the stored data or dumps it to a file or emits it as a  
message or starts pushing it to the output buffer or does whatever your  
application needs.

Happy Hacking,  
Marcus

---

<div class="post-metadata">

**Author:** ![sumitstop](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@sumitstop](https://www.ruby-forum.com/u/sumitstop)\
**Post date:** [September 5, 2013, 8:44pm UTC](https://www.ruby-forum.com/t/file-sink/246134/3 "2013-09-05T20:44:19Z")

</div>

Marcus… that easiest method gave me for a temporary solution… and I  
am  
happy with it for the time being  
cheers

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/File-sink-tp43431p43536.html](http://gnuradio.4.n7.nabble.com/File-sink-tp43431p43536.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).
