Re: grc amplitude demodulation questions

Martin, thanks for responding. See my follow ups below:
— On Thu, 1/13/11, Marcus D. Leech [email protected] wrote:

  1. What are good values for “Audio Pass” and "Audio
    produces at least some noise, the detected version
    of that noise results in a small residual DC offset. You can
    null it out with an
    an “ADD” block.

I’ve tried an ADD block, but I noticed that if my decimation is not a
power of 2, the offset changes.

move to the correct position. Any thoughts?
The FFT sink isn’t psychic. It needs to be told what
the current sample rate is, so if you change decimation on
the fly, you’ll need to
arrange for the FFT sink to know about the new
sample rate.
I believe the code is already doing this. Here are code segments for 2
fft guis. The first shows the fft of the raw output of the USRP2. This
gui responds correctly. Notice the line:
“sample_rate=100e6/usrp2_decim”, so I assume that as I dynamically
adjust usrp2_decim, this value is being updated. However, with the
second fft, while there is a similar line:
“sample_rate=100e6/usrp2_decim/sw_decim” that includes the software
decimation value, this fft gui does not correct the position of the fft
when I dynamically change sw_decim. The x-axis DOES change, but the
peaks in the spectrum just stay fixed in their relative positions. Any
thoughts?

1st FFT: self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
self.notebook_0.GetPage(1).GetWin(),
baseband_freq=0,
y_per_div=20,
y_divs=10,
ref_level=10,
ref_scale=2.0,
sample_rate=100e6/usrp2_decim,
fft_size=1024,
fft_rate=10,
average=False,
avg_alpha=None,
title=“Total Signal FFT”,
peak_hold=False,
)

2nd FFT: self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
self.notebook_0.GetPage(3).GetWin(),
baseband_freq=0,
y_per_div=20,
y_divs=10,
ref_level=10,
ref_scale=2.0,
sample_rate=100e6/usrp2_decim/sw_decim,
fft_size=1024,
fft_rate=10,
average=False,
avg_alpha=None,
title=“Demodulated FFT Plot”,
peak_hold=False,

positions. Any thoughts?

Where else is sw_decim used? Is it used in a parameter that can be
changed at runtime? Look at the generated source code, see set_sw_decim

-Josh

On 01/14/2011 02:56 PM, [email protected] wrote:

an “ADD” block.

I’ve tried an ADD block, but I noticed that if my decimation is not a power of
2, the offset changes.

Decimation filters will have slightly different output magnitude,
depending on parameters.
You’ll always have to re-null after changing decimation. Fact of
life.

  fft_size=1024,
  fft_rate=10,
  average=False,
  avg_alpha=None,
  title="Demodulated FFT Plot",
  peak_hold=False,

My first thought is evaluation ordering in the
100e6/usrp2_decim/sw_decim. What happens if you
re-express it as: (100e6/usrp2_decim)/sw_decim?


Principal Investigator
Shirleys Bay Radio Astronomy Consortium

Getting back to my question about adjusting decimation on the fly, and
having the FFT sink adjust to show the spectrum correctly, I have an
example of what I am doing on my site at:

www.nd.edu/~ematlis/z.gnuradio

There’s a jpg and the grc file there. If anybody would care to take a
look and comment, that would be great. Basically, I want to dynamically
adjust the software decimation going on in the AM Demod block, and have
the result shown correctly in the FFT sink. What I am seeing is the
x-axis of the FFT changes, but not the position of the spectrum. A
variable slider is used to control the decimation value in the AM Demod
block, and the Sample Rate in the FFT sink is dependent on the same
variable, but something is not correct.

Thanks,
eric

On Fri, Feb 4, 2011 at 9:33 PM, [email protected] wrote:

changes, but not the position of the spectrum. A variable slider is used to
control the decimation value in the AM Demod block, and the Sample Rate in
the FFT sink is dependent on the same variable, but something is not
correct.

The AM demodulator block does not support changing decimation during
runtime. You can check:
gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py
It has no methods for changing any parameters.

However, you can implement your own AM demod (it’s very simple) and
change
the decimation of the low pass filter - that should work.

Alex

— On Fri, 1/14/11, Josh B. [email protected] wrote:

“sample_rate=100e6/usrp2_decim”, so I assume that as I
the peaks in the spectrum just stay fixed in their
relative
positions. Any thoughts?

Where else is sw_decim used? Is it used in a parameter that
can be
changed at runtime? Look at the generated source code, see
set_sw_decim

-Josh
Josh-

here are the two definitions generated by GRC, one to set the USRP2
decimation (via a variable slider), the second to set the “audio
decimation” used in the AM Demod block:

def set_usrp2_decim(self, usrp2_decim):
self.usrp2_decim = usrp2_decim
self.wxgui_fftsink2_0.set_sample_rate(100e6/self.usrp2_decim)
self.wxgui_scopesink2_0.set_sample_rate(100e6/self.usrp2_decim)
self.usrp2_source_xxxx_0.set_decim(self.usrp2_decim)
self._usrp2_decim_slider.set_value(self.usrp2_decim)
self._usrp2_decim_text_box.set_value(self.usrp2_decim)
self.wxgui_scopesink2_0_0.set_sample_rate(100e6/self.usrp2_decim/self.sw_decim)
self.wxgui_fftsink2_1.set_sample_rate(100e6/self.usrp2_decim/self.sw_decim)
self.high_pass_filter_0.set_taps(firdes.high_pass(1,
100e6/self.usrp2_decim/self.sw_decim, 100, 20, firdes.WIN_HAMMING,
6.76))

def set_sw_decim(self, sw_decim):
self.sw_decim = sw_decim
self._sw_decim_slider.set_value(self.sw_decim)
self._sw_decim_text_box.set_value(self.sw_decim)
self.wxgui_scopesink2_0_0.set_sample_rate(100e6/self.usrp2_decim/self.sw_decim)
self.wxgui_fftsink2_1.set_sample_rate(100e6/self.usrp2_decim/self.sw_decim)
self.high_pass_filter_0.set_taps(firdes.high_pass(1,
100e6/self.usrp2_decim/self.sw_decim, 100, 20, firdes.WIN_HAMMING,
6.76))

On Fri, Feb 4, 2011 at 5:43 PM, Alexandru C. [email protected]
wrote:

adjust the software decimation going on in the AM Demod block, and have the
It has no methods for changing any parameters.

However, you can implement your own AM demod (it’s very simple) and change
the decimation of the low pass filter - that should work.

Alex

And feel free to contribute that improvement back, please!

Tom