On 3/17/19 3:01 PM, Kevin Reid wrote:
One of the AGC blocks that has separate attack and decay rates (agc2_cc
or agc3_cc) could be used to do this: set attack to 1, decay to 0,
ignore the output, and read (1.0 / agc.gain()) to find the peak-hold
magnitude.
In my own application, I am using this chain for peak detection
/without/ hold:
blocks.complex_to_mag_squared(),
blocks.stream_to_vector(itemsize=gr.sizeof_float,
nitems_per_block=window),
blocks.max_ff(window),
blocks.probe_signal_f()
but you would need to separately poll (at the sample rate divided by the
window length) and max-hold this to catch long-term peaks. On the
upside, as I just found out, it uses less CPU time than running the AGC
(on my processor).
This is where I get myself confused -- to get a magnitude do I need to
do an FFT, or can I just look at the raw complex stream, or the output
of complex_to_mag_squared without an FFT? I've used something like the
blocks you describe to capture the max within each FFT frame, but what
I'm looking for now is any instant where I get clipping, no matter how
brief.
If the only thing that affects the peak/gain is the recording, perhaps
you could measure the peak in the file offline (that is, separately from
running your real-time flowgraph) and use that to set the gain, instead
of having to interactively monitor anything.
That's an idea. Thanks!
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio