Hi Alex,
On Jul 16, 2010, at 9:05 AM, Elvis D. wrote:
When I hard-code the value to 32050Hz, the system plays back, but at a slower speed.
In the previous patch, I missed setting the frequency of the audio sink
to the rational resampler’s output rate as shown in the patch snippet.
Once I replaced it, it playback worked at the correct frequency.
# sound card as final sink
Now, there are 2 outstanding issues:
a. If I stop and restart the application, the system becomes unstable,
and I get a bunch of audio under-runs.
b. If I use the computed audio rate, which according to the code below,
results in it being 32051 Hz, the system doesn’t launch
audio_rate = demod_rate / audio_decimation # ~32 kHz
I get the following output, and the GUI doesn’t launch.
audio rate = 32051
Using RX d’board 0x0053
gr_fir_ccf: using SSE
gr_fir_fff: using SSE
interp = 48000
decim = 32051
If I hard code the values, and use the default options setting that I
just added, and use 32050 Hz, the application works. Why is that?
Best regards,
Elvis
PS: Here is the working patch, with the rational resampler after the WFM
demodulator. In this patch, the rational resampler’s audio input_rate is
set to 32050 Hz. Settting to to audio_rate computed from the WFM
demodulation block, results in 32051 Hz, which doesn’t work.
diff --git a/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py
b/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py
index 1783660…8adb845 100755
— a/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py
+++ b/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py
@@ -51,7 +51,10 @@ class wfm_rx_block (stdgui2.std_top_block):
help=“set volume (default is midpoint)”)
parser.add_option("-O", “–audio-output”, type=“string”,
default="",
help=“pcm device name. E.g., hw:0,0 or
surround51 or /dev/dsp”)
default=32050,
(%default)")
default=48000,
(%default)")
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
@@ -66,6 +69,7 @@ class wfm_rx_block (stdgui2.std_top_block):
# build graph
@@ -76,6 +80,7 @@ class wfm_rx_block (stdgui2.std_top_block):
demod_rate = usrp_rate / chanfilt_decim
audio_decimation = 10
audio_rate = demod_rate / audio_decimation # ~32 kHz
(gr-)usrp2 even
#when usrp(1) module is not built. A usrp_common module,
perhaps?
@@ -87,11 +92,13 @@ class wfm_rx_block (stdgui2.std_top_block):
dbid == 0x0040 or #usrp_dbid.TV_RX_REV_3
dbid == 0x0043 or #usrp_dbid.TV_RX_MIMO
dbid == 0x0044 or #usrp_dbid.TV_RX_REV_2_MIMO
frequency range"
print “for this application. Please use a BasicRX or TVRX
daughterboard.”
raw_input(“Press ENTER to continue anyway, or Ctrl-C to
exit.”)
rate
80e3, # passband
cutoff
@@ -101,17 +108,32 @@ class wfm_rx_block (stdgui2.std_top_block):
#print len(chan_filt_coeffs)
chan_filt = gr.fir_filter_ccf (chanfilt_decim,
chan_filt_coeffs)
-
# wide-band FM demodulator
self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
-
# rational resampler
-
input_rate = int(options.input_rate) # 32050 Hz default
-
#input_rate = audio_rate # 32051 Hz as
computed earlier (line 82), but hangs the application
-
output_rate = int(options.output_rate) # 48 kHz default
-
-
interp = gru.lcm(input_rate, output_rate) / input_rate
-
decim = gru.lcm(input_rate, output_rate) / output_rate
-
-
print "interp =", interp
-
print "decim =", decim
-
rr = blks2.rational_resampler_fff(interp, decim)
-
-
# volume control
self.volume_control = gr.multiply_const_ff(self.vol)
# sound card as final sink
self.volume_control, audio_sink)
-
self.connect (self.u, chan_filt, self.guts, rr,
self.volume_control, audio_sink)
self.volume_control, audio_sink)
self._build_gui(vbox, usrp_rate, demod_rate, audio_rate)