# Confusion about delay block

**URL:** <https://www.ruby-forum.com/t/confusion-about-delay-block/232590>\
**Category:** GNU Radio\
**Created:** [October 16, 2014, 10:26pm UTC](https://www.ruby-forum.com/t/confusion-about-delay-block/232590 "2014-10-16T22:26:12Z")\
**Posts on this page:** 1\
**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, 10:26pm UTC](https://www.ruby-forum.com/t/confusion-about-delay-block/232590/1 "2014-10-16T22:26:12Z")

</div>

Hi all,

A little while back I submitted an issue  
([http://gnuradio.org/redmine/issues/693](http://gnuradio.org/redmine/issues/693)) regarding the inability to  
instantiate the delay block with a negative int (to consume samples)  
despite the code comments and documentation.

Tom submitted a commit and clarified that you have to instantiate with a  
int \>=0, but that you can set a negative delay after the block is  
instantiated via set\_dly().

I am still unable to set a negative delay and I’m wondering if maybe I’m  
misunderstanding something.

In a topblock, I do…

```
    self.delay = blocks.delay(gr.sizeof_gr_complex, 0)

```

…and connect it to a USRP source.  
Then in a main loop which I use to run the flowgraph, I do…

```
while True:
    tb.delay.set_dly(-tb.fft_size)
    tb.start()
    tb.wait()

```

[…]

… I’d like to skip 1 fft\_frame worth of samples for each run of the  
flowgraph (after a frequency retune).

I get the following error, with both Ettus R.'s stable binary of  
gnuradio/uhd and with pybombs gnuradio and uhd, built today:

terminate called after throwing an instance of ‘std::invalid\_argument’  
what(): buffer\_add\_reader: nzero\_preload must be \>= 0  
Aborted (core dumped)

It seems that the delay block still can’t accept a negative delay (to  
consume samples) even after instantiating at 0, or am I missing  
something simple?

Thanks in advance!  
-Doug

Douglas Anderson | Intern  
DOC/NTIA/ITS-T | 325 Broadway St., Boulder, CO 80305 | P: 303 497 3582
