From c96248899b41bf28ee9602d793eec9fc17320996 Mon Sep 17 00:00:00 2001 From: mer0m Date: Sat, 18 Mar 2017 10:32:43 +0100 Subject: [PATCH] add fft --- sdr/fm_radio/fm_radio_comp_decim_lpf.grc | 313 ++++++++++++++++++++++++++++++- sdr/fm_radio/fm_radio_comp_decim_lpf.py | 50 ++++- 2 files changed, 360 insertions(+), 3 deletions(-) diff --git a/sdr/fm_radio/fm_radio_comp_decim_lpf.grc b/sdr/fm_radio/fm_radio_comp_decim_lpf.grc index 665255d..85bdb26 100644 --- a/sdr/fm_radio/fm_radio_comp_decim_lpf.grc +++ b/sdr/fm_radio/fm_radio_comp_decim_lpf.grc @@ -514,7 +514,7 @@ gui_hint - 12,0 + 13,0 _rotation @@ -761,6 +761,305 @@ dB + + qtgui_freq_sink_x + + autoscale + False + + + average + 0.05 + + + axislabels + True + + + bw + samp_rate*10 + + + alias + + + + fc + 0 + + + comment + + + + ctrlpanel + False + + + affinity + + + + _enabled + True + + + fftsize + 1024 + + + _coordinate + (840, 432) + + + gui_hint + 12,0 + + + _rotation + 0 + + + grid + True + + + id + qtgui_freq_sink_x_0_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "dark blue" + + + label10 + + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + width9 + 1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + name + "" + + + nconnections + 2 + + + showports + True + + + freqhalf + True + + + tr_chan + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_tag + "" + + + type + float + + + update_time + 0.10 + + + wintype + firdes.WIN_BLACKMAN_hARRIS + + + label + Relative Gain + + + ymax + 10 + + + ymin + -140 + + + units + dB + + qtgui_sink_x @@ -2583,6 +2882,12 @@ + + analog_wfm_rcv_0 + qtgui_freq_sink_x_0_0 + 0 + 0 + analog_wfm_rcv_0 rational_resampler_xxx_0 @@ -2595,6 +2900,12 @@ 0 0 + + analog_wfm_rcv_0_0 + qtgui_freq_sink_x_0_0 + 0 + 1 + low_pass_filter_0 analog_wfm_rcv_0_0 diff --git a/sdr/fm_radio/fm_radio_comp_decim_lpf.py b/sdr/fm_radio/fm_radio_comp_decim_lpf.py index 270a37a..3cfdcff 100755 --- a/sdr/fm_radio/fm_radio_comp_decim_lpf.py +++ b/sdr/fm_radio/fm_radio_comp_decim_lpf.py @@ -3,7 +3,7 @@ ################################################## # GNU Radio Python Flow Graph # Title: Fm Radio Comp Decim Lpf -# Generated: Sat Mar 18 09:58:42 2017 +# Generated: Sat Mar 18 10:30:17 2017 ################################################## if __name__ == '__main__': @@ -95,6 +95,49 @@ class fm_radio_comp_decim_lpf(gr.top_block, Qt.QWidget): taps=None, fractional_bw=None, ) + self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_f( + 1024, #size + firdes.WIN_BLACKMAN_hARRIS, #wintype + 0, #fc + samp_rate*10, #bw + "", #name + 2 #number of inputs + ) + self.qtgui_freq_sink_x_0_0.set_update_time(0.10) + self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10) + self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') + self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") + self.qtgui_freq_sink_x_0_0.enable_autoscale(False) + self.qtgui_freq_sink_x_0_0.enable_grid(True) + self.qtgui_freq_sink_x_0_0.set_fft_average(0.05) + self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) + self.qtgui_freq_sink_x_0_0.enable_control_panel(False) + + if not True: + self.qtgui_freq_sink_x_0_0.disable_legend() + + if "float" == "float" or "float" == "msg_float": + self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True) + + labels = ['', '', '', '', '', + '', '', '', '', ''] + widths = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + colors = ["blue", "red", "green", "black", "cyan", + "magenta", "yellow", "dark red", "dark green", "dark blue"] + alphas = [1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0] + for i in xrange(2): + if len(labels[i]) == 0: + self.qtgui_freq_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) + else: + self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) + self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) + self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) + self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) + + self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 12,0) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype @@ -137,7 +180,7 @@ class fm_radio_comp_decim_lpf(gr.top_block, Qt.QWidget): self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 12,0) + self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 13,0) self.low_pass_filter_0_0 = filter.fir_filter_fff(10, firdes.low_pass( 1, samp_rate*10, 96e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf(4, firdes.low_pass( @@ -155,8 +198,10 @@ class fm_radio_comp_decim_lpf(gr.top_block, Qt.QWidget): ################################################## # Connections ################################################## + self.connect((self.analog_wfm_rcv_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_wfm_rcv_0_0, 0), (self.low_pass_filter_0_0, 0)) + self.connect((self.analog_wfm_rcv_0_0, 0), (self.qtgui_freq_sink_x_0_0, 1)) self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0)) @@ -176,6 +221,7 @@ class fm_radio_comp_decim_lpf(gr.top_block, Qt.QWidget): def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.rtlsdr_source_0.set_sample_rate(self.samp_rate*10*4) + self.qtgui_freq_sink_x_0_0.set_frequency_range(0, self.samp_rate*10) self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate*10, 96e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate*10*4, 100e3, 1e3, firdes.WIN_HAMMING, 6.76)) -- 2.16.4