# GRC, Recording chunks of spectrum triggered on input signal level

**URL:** <https://www.ruby-forum.com/t/grc-recording-chunks-of-spectrum-triggered-on-input-signal-level/233036>\
**Category:** GNU Radio\
**Created:** [November 12, 2014, 8:55pm UTC](https://www.ruby-forum.com/t/grc-recording-chunks-of-spectrum-triggered-on-input-signal-level/233036 "2014-11-12T20:55:55Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Staffan\_Bruce](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6bbea6/32.png) [@Staffan\_Bruce](https://www.ruby-forum.com/u/Staffan_Bruce)\
**Post date:** [November 17, 2014, 7:05pm UTC](https://www.ruby-forum.com/t/grc-recording-chunks-of-spectrum-triggered-on-input-signal-level/233036/9 "2014-11-17T19:05:48Z")

</div>

If you are using an “if” statement to switch between filename and  
/dev/null,  
try putting the filename construction in the “if” statement, instead of  
a  
separate variable. That may make it evaluate every time the “if”  
statement  
is called.

My example used the LO frequency as part of the filename, and every time  
the  
QT GUI slider changed the LO, it probably updated the filename.

If that does not work, maybe you can use a probe to examine a signal,  
say  
10x a second. Then the probe level() function could be used as part of  
the  
filename. That would at least change it 10x a second.

For the counter, maybe you could also use a probes to look at a signal  
before and after a N sample delay, where delay and sample rate is about  
the  
same time as your probe rate; then this pseudocode:

if now.level() != delayed.level() then count = count +1

At this point though you ought to delve into the Python. As long as you  
are  
not using the QT GUI, the code is pretty straight forward. You can use  
probes to pull values out of the flow and evaluate them in Python.

Thanks,  
Lou  
KD4HSO

Staffan wrote

> In addition, it would be great to have some kind of a counter (variable, x  
> Staffan  
> –  
> View this message in context:  
> [http://gnuradio.4.n7.nabble.com/GRC-Recording-chunks-of-spectrum-triggered-on-input-signal-level-tp51302p51339.html](http://gnuradio.4.n7.nabble.com/GRC-Recording-chunks-of-spectrum-triggered-on-input-signal-level-tp51302p51339.html)  
> Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

_[View the full topic](https://www.ruby-forum.com/t/grc-recording-chunks-of-spectrum-triggered-on-input-signal-level/233036)._
