Hi Alex, On Jul 16, 2010, at 2:02 AM, Alexandru Csete wrote:
> I suggest you leave the pre-demodulator settings as they are in the > example and add a rational resampler after the demodulator, see > examples/audio/test_resampler.py on how to use it. I looked at the rational resample example, and modified the usrp2_wfm_rcv.py script. The results weren't good, and it appeared that the playback was re-sampled to a lower rate, with the music playing back as if the speed was slowed down. The audio_rate, when computed is 32051Hz, but using that value completely hangs the system. When I hard-code the value to 32050Hz, the system plays back, but at a slower speed. The output sample rate is set to 48000Hz. I have attached the patch below, could you let me know if the modifications are correct? Elvis Dowsn diff --git a/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py b/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py index 1783660..0184725 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") - + parser.add_option("-i", "--input-rate", type="eng_float", default=32050, + help="set input sample rate to RATE (%default)") + parser.add_option("-o", "--output-rate", type="eng_float", default=48000, + help="set output sample rate to RATE (%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 + # USRP2 source self.u = usrp2.source_32fc(options.interface, options.mac_addr) adc_rate = self.u.adc_rate() # 100 MS/s @@ -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 + print "audio rate =", audio_rate #FIXME: need named constants and text descriptions available to (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 - dbid == 0x0045 ): #usrp_dbid.TV_RX_REV_3_MIMO + dbid == 0x0045 or #usrp_dbid.TV_RX_REV_3_MIMO + dbid == 0x0053 ): #usrp_dbid.WBX print "This daughterboard does not cover the required 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.") + # channel filter co-efficients chan_filt_coeffs = optfir.low_pass (1, # gain usrp_rate, # sampling rate 80e3, # passband cutoff @@ -101,8 +108,22 @@ 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 @@ -111,7 +132,7 @@ class wfm_rx_block (stdgui2.std_top_block): False) # ok_to_block # now wire it all together - self.connect (self.u, chan_filt, self.guts, self.volume_control, audio_sink) + self.connect (self.u, chan_filt, self.guts, rr, self.volume_control, audio_sink) self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio