diff --git a/apps/am_flow_example.grc b/apps/am_flow_example.grc index 6132486..bd97773 100644 --- a/apps/am_flow_example.grc +++ b/apps/am_flow_example.grc @@ -1,4138 +1,1276 @@ - - - - Fri Jul 3 12:44:24 2015 - - options - - author - - - - alias - - - - window_size - 1280, 1024 - - - category - Custom - - - comment - - - - description - Example of GR DSP flow in receiver.py - - - _enabled - True - - - _coordinate - (8, 7) - - - _rotation - 0 - - - generate_options - qt_gui - - - id - am_flow_example - - - max_nouts - 0 - - - realtime_scheduling - - - - run_options - prompt - - - run - True - - - thread_safe_setters - - - - title - Ham2Mon AM Receiver Flow Example - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (16, 285) - - - _rotation - 0 - - - id - center_freq - - - value - 144E6 - - - - variable_qtgui_range - - comment - - - - value - 390E3 - - - _enabled - True - - - _coordinate - (24, 385) - - - gui_hint - 3,1,1,3 - - - _rotation - 0 - - - id - demod_bb_freq - - - label - "Demod BB Freq (Hz)" - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - -samp_rate/2 - - - step - 5E3 - - - stop - samp_rate/2 - - - rangeType - float - - - widget - counter_slider - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (464, 13) - - - _rotation - 0 - - - id - fft_length - - - value - 256 * int(pow(2, np.ceil(np.log(samp_ratio)/np.log(2)))) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (304, 700) - - - _rotation - 0 - - - id - file_name - - - value - "test.wav" - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (808, 332) - - - _rotation - 0 - - - id - final_decim - - - value - int(samp_rate/1E6) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (808, 396) - - - _rotation - 0 - - - id - final_rate - - - value - samp_rate/initial_decim**2/int(samp_rate/1E6) - - - - variable_qtgui_range - - comment - - - - value - 30 - - - _enabled - True - - - _coordinate - (568, 9) - - - gui_hint - 4,1,1,3 - - - _rotation - 0 - - - id - gain_db - - - label - "HW Gain (dB)" - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - 0 - - - step - 1 - - - stop - 70 - - - rangeType - float - - - widget - counter_slider - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (432, 405) - - - _rotation - 0 - - - id - initial_decim - - - value - 5 - - - - variable - - comment - 1E6 minimum - - - _enabled - True - - - _coordinate - (272, 13) - - - _rotation - 0 - - - id - samp_rate - - - value - 1E6 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (368, 13) - - - _rotation - 0 - - - id - samp_ratio - - - value - samp_rate/1E6 - - - - variable_qtgui_range - - comment - - - - value - -70 - - - _enabled - True - - - _coordinate - (672, 734) - - - gui_hint - 5,1,1,3 - - - _rotation - 0 - - - id - squelch_dB - - - label - "Squelch (dB)" - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - -100 - - - step - 5 - - - stop - 0 - - - rangeType - float - - - widget - counter_slider - - - - variable_low_pass_filter_taps - - beta - 6.76 - - - comment - - - - cutoff_freq - 0.090 - - - _enabled - True - - - _coordinate - (248, 338) - - - _rotation - 0 - - - gain - 1.0 - - - id - variable_low_pass_filter_taps_0 - - - samp_rate - 1 - - - width - 0.010 - - - win - firdes.WIN_HAMMING - - - - variable_low_pass_filter_taps - - beta - 6.76 - - - comment - - - - cutoff_freq - 12.5E3 - - - _enabled - True - - - _coordinate - (664, 330) - - - _rotation - 0 - - - gain - 1.0 - - - id - variable_low_pass_filter_taps_1 - - - samp_rate - samp_rate/25 - - - width - 1E3 - - - win - firdes.WIN_HAMMING - - - - variable_low_pass_filter_taps - - beta - 6.76 - - - comment - - - - cutoff_freq - 3500 - - - _enabled - True - - - _coordinate - (928, 710) - - - _rotation - 0 - - - gain - 1.0 - - - id - variable_low_pass_filter_taps_2 - - - samp_rate - final_rate - - - width - 500 - - - win - firdes.WIN_HAMMING - - - - analog_agc3_xx - - attack_rate - 1e-0 - - - alias - - - - comment - - - - affinity - - - - decay_rate - 1e-4 - - - _enabled - 1 - - - _coordinate - (1104, 454) - - - _rotation - 0 - - - gain - 10 - - - id - analog_agc3_xx_0 - - - iir_update_decim - 1 - - - max_gain - 10000 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - reference - 0.1 - - - type - complex - - - - analog_pwr_squelch_xx - - alpha - 0.1 - - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - _coordinate - (952, 469) - - - _rotation - 0 - - - gate - False - - - id - analog_pwr_squelch_xx_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - ramp - 0 - - - threshold - squelch_dB - - - type - complex - - - - analog_pwr_squelch_xx - - alpha - 0.1 - - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - _coordinate - (480, 613) - - - _rotation - 180 - - - gate - True - - - id - analog_pwr_squelch_xx_0_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - ramp - 0 - - - threshold - -200 - - - type - float - - - - audio_sink - - alias - - - - comment - - - - affinity - - - - device_name - - - - _enabled - True - - - _coordinate - (480, 715) - - - _rotation - 180 - - - id - audio_sink_0 - - - num_inputs - 1 - - - ok_to_block - True - - - samp_rate - 16000 - - - - blocks_complex_to_mag - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - _coordinate - (1128, 641) - - - _rotation - 180 - - - id - blocks_complex_to_mag_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - vlen - 1 - - - - blocks_complex_to_mag_squared - - alias - - - - comment - Compute power - - - affinity - - - - _enabled - True - - - _coordinate - (888, 204) - - - _rotation - 0 - - - id - blocks_complex_to_mag_squared_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - vlen - fft_length - - - - blocks_integrate_xx - - alias - - - - comment - Video average down to 10 FFT/sec - - - affinity - - - - decim - 100 - - - _enabled - True - - - _coordinate - (1080, 197) - - - _rotation - 0 - - - id - blocks_integrate_xx_0 - - - type - float - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - vlen - fft_length - - - - blocks_keep_one_in_n - - alias - - - - comment - Want about 1000 FFT/sec -Keep 1 in 4 vectors - - - affinity - - - - _enabled - True - - - _coordinate - (472, 197) - - - _rotation - 0 - - - id - blocks_keep_one_in_n_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - n - int(round(samp_rate/fft_length/1000)) - - - type - complex - - - vlen - fft_length - - - - blocks_nlog10_ff - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - _coordinate - (1096, 54) - - - _rotation - 180 - - - id - blocks_nlog10_ff_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - vlen - fft_length - - - k - 0 - - - n - 10 - - - - blocks_probe_signal_vx - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - _coordinate - (896, 124) - - - _rotation - 180 - - - id - blocks_probe_signal_vx_0 - - - type - float - - - vlen - fft_length - - - - blocks_stream_to_vector - - alias - - - - comment - Example: -1024 length FFT -4 Msps / 1024 = 3906.25 Hz/bin -Also 3902.25 vec/sec - - - affinity - - - - _enabled - True - - - _coordinate - (256, 204) - - - _rotation - 0 - - - id - blocks_stream_to_vector_0 - - - type - complex - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - num_items - fft_length - - - vlen - 1 - - - - blocks_vector_to_stream - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - _coordinate - (928, 68) - - - _rotation - 180 - - - id - blocks_vector_to_stream_0 - - - type - float - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - num_items - fft_length - - - vlen - 1 - - - - blocks_wavfile_sink - - bits_per_sample - 8 - - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - file - file_name - - - _coordinate - (304, 620) - - - _rotation - 180 - - - id - blocks_wavfile_sink_0 - - - nchan - 1 - - - samp_rate - 16000 - - - - fft_vxx - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - fft_size - fft_length - - - forward - True - - - _coordinate - (656, 176) - - - _rotation - 0 - - - id - fft_vxx_0 - - - type - complex - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - nthreads - 1 - - - shift - True - - - window - window.blackmanharris(fft_length) - - - - fir_filter_xxx - - alias - - - - comment - samp_rate/5 to samp_rate/25 - - - affinity - - - - decim - initial_decim - - - _enabled - 1 - - - _coordinate - (488, 485) - - - _rotation - 0 - - - id - fir_filter_xxx_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samp_delay - 0 - - - taps - variable_low_pass_filter_taps_0 - - - type - ccc - - - - fir_filter_xxx - - alias - - - - comment - samp_rate/100 to 40-80 ksps - - - affinity - - - - decim - int(samp_rate/1E6) - - - _enabled - 1 - - - _coordinate - (688, 485) - - - _rotation - 0 - - - id - fir_filter_xxx_0_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samp_delay - 0 - - - taps - variable_low_pass_filter_taps_0 - - - type - ccc - - - - fir_filter_xxx - - alias - - - - comment - 40-80 ksps to 8-16 ksps - - - affinity - - - - decim - initial_decim - - - _enabled - 1 - - - _coordinate - (920, 628) - - - _rotation - 180 - - - id - fir_filter_xxx_0_1 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samp_delay - 0 - - - taps - variable_low_pass_filter_taps_0 - - - type - fff - - - - freq_xlating_fir_filter_xxx - - alias - - - - center_freq - demod_bb_freq - - - comment - samp_rate to samp_rate/5 - - - affinity - - - - decim - initial_decim - - - _enabled - 1 - - - _coordinate - (248, 471) - - - _rotation - 0 - - - id - freq_xlating_fir_filter_xxx_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samp_rate - samp_rate - - - taps - variable_low_pass_filter_taps_0 - - - type - ccc - - - - import - - alias - - - - comment - - - - _enabled - True - - - _coordinate - (192, 12) - - - _rotation - 0 - - - id - import_0 - - - import - import numpy as np - - - - osmosdr_source - - alias - - - - ant0 - - - - bb_gain0 - 20 - - - bw0 - samp_rate*0.8 - - - dc_offset_mode0 - 0 - - - corr0 - 0 - - - freq0 - center_freq - - - gain_mode0 - False - - - if_gain0 - 20 - - - iq_balance_mode0 - 0 - - - gain0 - gain_db - - - ant10 - - - - bb_gain10 - 20 - - - bw10 - 0 - - - dc_offset_mode10 - 0 - - - corr10 - 0 - - - freq10 - 100e6 - - - gain_mode10 - False - - - if_gain10 - 20 - - - iq_balance_mode10 - 0 - - - gain10 - 10 - - - ant11 - - - - bb_gain11 - 20 - - - bw11 - 0 - - - dc_offset_mode11 - 0 - - - corr11 - 0 - - - freq11 - 100e6 - - - gain_mode11 - False - - - if_gain11 - 20 - - - iq_balance_mode11 - 0 - - - gain11 - 10 - - - ant12 - - - - bb_gain12 - 20 - - - bw12 - 0 - - - dc_offset_mode12 - 0 - - - corr12 - 0 - - - freq12 - 100e6 - - - gain_mode12 - False - - - if_gain12 - 20 - - - iq_balance_mode12 - 0 - - - gain12 - 10 - - - ant13 - - - - bb_gain13 - 20 - - - bw13 - 0 - - - dc_offset_mode13 - 0 - - - corr13 - 0 - - - freq13 - 100e6 - - - gain_mode13 - False - - - if_gain13 - 20 - - - iq_balance_mode13 - 0 - - - gain13 - 10 - - - ant14 - - - - bb_gain14 - 20 - - - bw14 - 0 - - - dc_offset_mode14 - 0 - - - corr14 - 0 - - - freq14 - 100e6 - - - gain_mode14 - False - - - if_gain14 - 20 - - - iq_balance_mode14 - 0 - - - gain14 - 10 - - - ant15 - - - - bb_gain15 - 20 - - - bw15 - 0 - - - dc_offset_mode15 - 0 - - - corr15 - 0 - - - freq15 - 100e6 - - - gain_mode15 - False - - - if_gain15 - 20 - - - iq_balance_mode15 - 0 - - - gain15 - 10 - - - ant16 - - - - bb_gain16 - 20 - - - bw16 - 0 - - - dc_offset_mode16 - 0 - - - corr16 - 0 - - - freq16 - 100e6 - - - gain_mode16 - False - - - if_gain16 - 20 - - - iq_balance_mode16 - 0 - - - gain16 - 10 - - - ant17 - - - - bb_gain17 - 20 - - - bw17 - 0 - - - dc_offset_mode17 - 0 - - - corr17 - 0 - - - freq17 - 100e6 - - - gain_mode17 - False - - - if_gain17 - 20 - - - iq_balance_mode17 - 0 - - - gain17 - 10 - - - ant18 - - - - bb_gain18 - 20 - - - bw18 - 0 - - - dc_offset_mode18 - 0 - - - corr18 - 0 - - - freq18 - 100e6 - - - gain_mode18 - False - - - if_gain18 - 20 - - - iq_balance_mode18 - 0 - - - gain18 - 10 - - - ant19 - - - - bb_gain19 - 20 - - - bw19 - 0 - - - dc_offset_mode19 - 0 - - - corr19 - 0 - - - freq19 - 100e6 - - - gain_mode19 - False - - - if_gain19 - 20 - - - iq_balance_mode19 - 0 - - - gain19 - 10 - - - ant1 - - - - bb_gain1 - 20 - - - bw1 - 0 - - - dc_offset_mode1 - 0 - - - corr1 - 0 - - - freq1 - 100e6 - - - gain_mode1 - False - - - if_gain1 - 20 - - - iq_balance_mode1 - 0 - - - gain1 - 10 - - - ant20 - - - - bb_gain20 - 20 - - - bw20 - 0 - - - dc_offset_mode20 - 0 - - - corr20 - 0 - - - freq20 - 100e6 - - - gain_mode20 - False - - - if_gain20 - 20 - - - iq_balance_mode20 - 0 - - - gain20 - 10 - - - ant21 - - - - bb_gain21 - 20 - - - bw21 - 0 - - - dc_offset_mode21 - 0 - - - corr21 - 0 - - - freq21 - 100e6 - - - gain_mode21 - False - - - if_gain21 - 20 - - - iq_balance_mode21 - 0 - - - gain21 - 10 - - - ant22 - - - - bb_gain22 - 20 - - - bw22 - 0 - - - dc_offset_mode22 - 0 - - - corr22 - 0 - - - freq22 - 100e6 - - - gain_mode22 - False - - - if_gain22 - 20 - - - iq_balance_mode22 - 0 - - - gain22 - 10 - - - ant23 - - - - bb_gain23 - 20 - - - bw23 - 0 - - - dc_offset_mode23 - 0 - - - corr23 - 0 - - - freq23 - 100e6 - - - gain_mode23 - False - - - if_gain23 - 20 - - - iq_balance_mode23 - 0 - - - gain23 - 10 - - - ant24 - - - - bb_gain24 - 20 - - - bw24 - 0 - - - dc_offset_mode24 - 0 - - - corr24 - 0 - - - freq24 - 100e6 - - - gain_mode24 - False - - - if_gain24 - 20 - - - iq_balance_mode24 - 0 - - - gain24 - 10 - - - ant25 - - - - bb_gain25 - 20 - - - bw25 - 0 - - - dc_offset_mode25 - 0 - - - corr25 - 0 - - - freq25 - 100e6 - - - gain_mode25 - False - - - if_gain25 - 20 - - - iq_balance_mode25 - 0 - - - gain25 - 10 - - - ant26 - - - - bb_gain26 - 20 - - - bw26 - 0 - - - dc_offset_mode26 - 0 - - - corr26 - 0 - - - freq26 - 100e6 - - - gain_mode26 - False - - - if_gain26 - 20 - - - iq_balance_mode26 - 0 - - - gain26 - 10 - - - ant27 - - - - bb_gain27 - 20 - - - bw27 - 0 - - - dc_offset_mode27 - 0 - - - corr27 - 0 - - - freq27 - 100e6 - - - gain_mode27 - False - - - if_gain27 - 20 - - - iq_balance_mode27 - 0 - - - gain27 - 10 - - - ant28 - - - - bb_gain28 - 20 - - - bw28 - 0 - - - dc_offset_mode28 - 0 - - - corr28 - 0 - - - freq28 - 100e6 - - - gain_mode28 - False - - - if_gain28 - 20 - - - iq_balance_mode28 - 0 - - - gain28 - 10 - - - ant29 - - - - bb_gain29 - 20 - - - bw29 - 0 - - - dc_offset_mode29 - 0 - - - corr29 - 0 - - - freq29 - 100e6 - - - gain_mode29 - False - - - if_gain29 - 20 - - - iq_balance_mode29 - 0 - - - gain29 - 10 - - - ant2 - - - - bb_gain2 - 20 - - - bw2 - 0 - - - dc_offset_mode2 - 0 - - - corr2 - 0 - - - freq2 - 100e6 - - - gain_mode2 - False - - - if_gain2 - 20 - - - iq_balance_mode2 - 0 - - - gain2 - 10 - - - ant30 - - - - bb_gain30 - 20 - - - bw30 - 0 - - - dc_offset_mode30 - 0 - - - corr30 - 0 - - - freq30 - 100e6 - - - gain_mode30 - False - - - if_gain30 - 20 - - - iq_balance_mode30 - 0 - - - gain30 - 10 - - - ant31 - - - - bb_gain31 - 20 - - - bw31 - 0 - - - dc_offset_mode31 - 0 - - - corr31 - 0 - - - freq31 - 100e6 - - - gain_mode31 - False - - - if_gain31 - 20 - - - iq_balance_mode31 - 0 - - - gain31 - 10 - - - ant3 - - - - bb_gain3 - 20 - - - bw3 - 0 - - - dc_offset_mode3 - 0 - - - corr3 - 0 - - - freq3 - 100e6 - - - gain_mode3 - False - - - if_gain3 - 20 - - - iq_balance_mode3 - 0 - - - gain3 - 10 - - - ant4 - - - - bb_gain4 - 20 - - - bw4 - 0 - - - dc_offset_mode4 - 0 - - - corr4 - 0 - - - freq4 - 100e6 - - - gain_mode4 - False - - - if_gain4 - 20 - - - iq_balance_mode4 - 0 - - - gain4 - 10 - - - ant5 - - - - bb_gain5 - 20 - - - bw5 - 0 - - - dc_offset_mode5 - 0 - - - corr5 - 0 - - - freq5 - 100e6 - - - gain_mode5 - False - - - if_gain5 - 20 - - - iq_balance_mode5 - 0 - - - gain5 - 10 - - - ant6 - - - - bb_gain6 - 20 - - - bw6 - 0 - - - dc_offset_mode6 - 0 - - - corr6 - 0 - - - freq6 - 100e6 - - - gain_mode6 - False - - - if_gain6 - 20 - - - iq_balance_mode6 - 0 - - - gain6 - 10 - - - ant7 - - - - bb_gain7 - 20 - - - bw7 - 0 - - - dc_offset_mode7 - 0 - - - corr7 - 0 - - - freq7 - 100e6 - - - gain_mode7 - False - - - if_gain7 - 20 - - - iq_balance_mode7 - 0 - - - gain7 - 10 - - - ant8 - - - - bb_gain8 - 20 - - - bw8 - 0 - - - dc_offset_mode8 - 0 - - - corr8 - 0 - - - freq8 - 100e6 - - - gain_mode8 - False - - - if_gain8 - 20 - - - iq_balance_mode8 - 0 - - - gain8 - 10 - - - ant9 - - - - bb_gain9 - 20 - - - bw9 - 0 - - - dc_offset_mode9 - 0 - - - corr9 - 0 - - - freq9 - 100e6 - - - gain_mode9 - False - - - if_gain9 - 20 - - - iq_balance_mode9 - 0 - - - gain9 - 10 - - - comment - - - - affinity - - - - args - uhd - - - _enabled - True - - - _coordinate - (8, 92) - - - _rotation - 0 - - - id - osmosdr_source_0 - - - maxoutbuf - 0 - - - clock_source0 - - - - time_source0 - - - - clock_source1 - - - - time_source1 - - - - clock_source2 - - - - time_source2 - - - - clock_source3 - - - - time_source3 - - - - clock_source4 - - - - time_source4 - - - - clock_source5 - - - - time_source5 - - - - clock_source6 - - - - time_source6 - - - - clock_source7 - - - - time_source7 - - - - minoutbuf - 0 - - - nchan - 1 - - - num_mboards - 1 - - - type - fc32 - - - sample_rate - samp_rate - - - sync - - - - - pfb_arb_resampler_xxx - - alias - - - - comment - Note this is set for 16 kHz (not 8 kHz) - - - affinity - - - - _enabled - True - - - _coordinate - (672, 613) - - - _rotation - 180 - - - id - pfb_arb_resampler_xxx_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - nfilts - 32 - - - rrate - 16E3/float(final_rate/5) - - - samp_delay - 0 - - - atten - 100 - - - taps - - - - type - fff - - - - qtgui_freq_sink_x - - autoscale - False - - - average - 1.0 - - - bw - samp_rate - - - alias - - - - fc - 144E6 - - - comment - - - - ctrlpanel - False - - - affinity - - - - _enabled - True - - - fftsize - fft_length - - - _coordinate - (272, 111) - - - gui_hint - 0,0,3,1 - - - _rotation - 0 - - - grid - False - - - id - qtgui_freq_sink_x_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 - "Spectrum" - - - nconnections - 1 - - - showports - True - - - freqhalf - True - - - tr_chan - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_tag - "" - - - type - complex - - - update_time - 0.10 - - - wintype - firdes.WIN_BLACKMAN_hARRIS - - - ymax - -20 - - - ymin - -120 - - - - qtgui_freq_sink_x - - autoscale - False - - - average - 1.0 - - - bw - final_rate - - - alias - - - - fc - 0 - - - comment - - - - ctrlpanel - False - - - affinity - - - - _enabled - True - - - fftsize - 1024 - - - _coordinate - (1016, 317) - - - gui_hint - 3,0,3,1 - - - _rotation - 0 - - - grid - False - - - 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 - "Decimated Channel" - - - nconnections - 1 - - - showports - True - - - freqhalf - True - - - tr_chan - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_tag - "" - - - type - complex - - - update_time - 0.10 - - - wintype - firdes.WIN_BLACKMAN_hARRIS - - - ymax - -60 - - - ymin - -200 - - - - qtgui_time_sink_x - - autoscale - False - - - alias - - - - comment - - - - ctrlpanel - False - - - affinity - - - - entags - True - - - _enabled - True - - - _coordinate - (704, 47) - - - gui_hint - 0,1,3,1 - - - _rotation - 180 - - - grid - False - - - id - qtgui_time_sink_x_0 - - - legend - True - - - alpha1 - 1.0 - - - color1 - "blue" - - - label1 - - - - marker1 - -1 - - - style1 - 1 - - - width1 - 1 - - - alpha10 - 1.0 - - - color10 - "blue" - - - label10 - - - - marker10 - -1 - - - style10 - 1 - - - width10 - 1 - - - alpha2 - 1.0 - - - color2 - "red" - - - label2 - - - - marker2 - -1 - - - style2 - 1 - - - width2 - 1 - - - alpha3 - 1.0 - - - color3 - "green" - - - label3 - - - - marker3 - -1 - - - style3 - 1 - - - width3 - 1 - - - alpha4 - 1.0 - - - color4 - "black" - - - label4 - - - - marker4 - -1 - - - style4 - 1 - - - width4 - 1 - - - alpha5 - 1.0 - - - color5 - "cyan" - - - label5 - - - - marker5 - -1 - - - style5 - 1 - - - width5 - 1 - - - alpha6 - 1.0 - - - color6 - "magenta" - - - label6 - - - - marker6 - -1 - - - style6 - 1 - - - width6 - 1 - - - alpha7 - 1.0 - - - color7 - "yellow" - - - label7 - - - - marker7 - -1 - - - style7 - 1 - - - width7 - 1 - - - alpha8 - 1.0 - - - color8 - "dark red" - - - label8 - - - - marker8 - -1 - - - style8 - 1 - - - width8 - 1 - - - alpha9 - 1.0 - - - color9 - "dark green" - - - label9 - - - - marker9 - -1 - - - style9 - 1 - - - width9 - 1 - - - name - "Averaged Spectrum" - - - nconnections - 1 - - - size - fft_length - - - srate - samp_rate - - - tr_chan - 0 - - - tr_delay - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_slope - qtgui.TRIG_SLOPE_POS - - - tr_tag - "" - - - type - float - - - update_time - 0.10 - - - ylabel - Power - - - yunit - "" - - - ymax - 40 - - - ymin - -60 - - - - analog_agc3_xx_0 - blocks_complex_to_mag_0 - 0 - 0 - - - analog_pwr_squelch_xx_0 - analog_agc3_xx_0 - 0 - 0 - - - analog_pwr_squelch_xx_0_0 - blocks_wavfile_sink_0 - 0 - 0 - - - blocks_complex_to_mag_0 - fir_filter_xxx_0_1 - 0 - 0 - - - blocks_complex_to_mag_squared_0 - blocks_integrate_xx_0 - 0 - 0 - - - blocks_integrate_xx_0 - blocks_nlog10_ff_0 - 0 - 0 - - - blocks_keep_one_in_n_0 - fft_vxx_0 - 0 - 0 - - - blocks_nlog10_ff_0 - blocks_probe_signal_vx_0 - 0 - 0 - - - blocks_nlog10_ff_0 - blocks_vector_to_stream_0 - 0 - 0 - - - blocks_stream_to_vector_0 - blocks_keep_one_in_n_0 - 0 - 0 - - - blocks_vector_to_stream_0 - qtgui_time_sink_x_0 - 0 - 0 - - - fft_vxx_0 - blocks_complex_to_mag_squared_0 - 0 - 0 - - - fir_filter_xxx_0 - fir_filter_xxx_0_0 - 0 - 0 - - - fir_filter_xxx_0_0 - analog_pwr_squelch_xx_0 - 0 - 0 - - - fir_filter_xxx_0_0 - qtgui_freq_sink_x_0_0 - 0 - 0 - - - fir_filter_xxx_0_1 - pfb_arb_resampler_xxx_0 - 0 - 0 - - - freq_xlating_fir_filter_xxx_0 - fir_filter_xxx_0 - 0 - 0 - - - osmosdr_source_0 - blocks_stream_to_vector_0 - 0 - 0 - - - osmosdr_source_0 - freq_xlating_fir_filter_xxx_0 - 0 - 0 - - - osmosdr_source_0 - qtgui_freq_sink_x_0 - 0 - 0 - - - pfb_arb_resampler_xxx_0 - analog_pwr_squelch_xx_0_0 - 0 - 0 - - - pfb_arb_resampler_xxx_0 - audio_sink_0 - 0 - 0 - - +options: + parameters: + author: '' + catch_exceptions: 'True' + category: Custom + cmake_opt: '' + comment: '' + copyright: '' + description: Example of GR DSP flow in receiver.py + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: am_flow_example + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: Ham2Mon AM Receiver Flow Example + window_size: 1280, 1024 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 7] + rotation: 0 + state: enabled + +blocks: +- name: center_freq + id: variable + parameters: + comment: '' + value: 144E6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [16, 285] + rotation: 0 + state: enabled +- name: demod_bb_freq + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 3,1,1,3 + label: '"Demod BB Freq (Hz)"' + min_len: '200' + orient: QtCore.Qt.Horizontal + outputmsgname: value + rangeType: float + showports: 'False' + start: -samp_rate/2 + step: 5E3 + stop: samp_rate/2 + value: 390E3 + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [24, 385] + rotation: 0 + state: enabled +- name: fft_length + id: variable + parameters: + comment: '' + value: 256 * int(pow(2, np.ceil(np.log(samp_ratio)/np.log(2)))) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [464, 13] + rotation: 0 + state: enabled +- name: file_name + id: variable + parameters: + comment: '' + value: '"test.wav"' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [304, 700] + rotation: 0 + state: enabled +- name: final_decim + id: variable + parameters: + comment: '' + value: int(samp_rate/1E6) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [808, 332] + rotation: 0 + state: enabled +- name: final_rate + id: variable + parameters: + comment: '' + value: samp_rate/initial_decim**2/int(samp_rate/1E6) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [808, 396] + rotation: 0 + state: enabled +- name: gain_db + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 4,1,1,3 + label: '"HW Gain (dB)"' + min_len: '200' + orient: QtCore.Qt.Horizontal + outputmsgname: value + rangeType: float + showports: 'False' + start: '0' + step: '1' + stop: '70' + value: '30' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [568, 9] + rotation: 0 + state: enabled +- name: initial_decim + id: variable + parameters: + comment: '' + value: '5' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [432, 405] + rotation: 0 + state: enabled +- name: samp_rate + id: variable + parameters: + comment: 1E6 minimum + value: 1E6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [272, 13] + rotation: 0 + state: enabled +- name: samp_ratio + id: variable + parameters: + comment: '' + value: samp_rate/1E6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [368, 13] + rotation: 0 + state: enabled +- name: squelch_dB + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 5,1,1,3 + label: '"Squelch (dB)"' + min_len: '200' + orient: QtCore.Qt.Horizontal + outputmsgname: value + rangeType: float + showports: 'False' + start: '-100' + step: '5' + stop: '0' + value: '-70' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [672, 734] + rotation: 0 + state: enabled +- name: variable_low_pass_filter_taps_0 + id: variable_low_pass_filter_taps + parameters: + beta: '6.76' + comment: '' + cutoff_freq: '0.090' + gain: '1.0' + samp_rate: '1' + value: '' + width: '0.010' + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [248, 338] + rotation: 0 + state: enabled +- name: variable_low_pass_filter_taps_1 + id: variable_low_pass_filter_taps + parameters: + beta: '6.76' + comment: '' + cutoff_freq: 12.5E3 + gain: '1.0' + samp_rate: samp_rate/25 + value: '' + width: 1E3 + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [664, 330] + rotation: 0 + state: enabled +- name: variable_low_pass_filter_taps_2 + id: variable_low_pass_filter_taps + parameters: + beta: '6.76' + comment: '' + cutoff_freq: '3500' + gain: '1.0' + samp_rate: final_rate + value: '' + width: '500' + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [928, 710] + rotation: 0 + state: enabled +- name: analog_agc3_xx_0 + id: analog_agc3_xx + parameters: + affinity: '' + alias: '' + attack_rate: 1e-0 + comment: '' + decay_rate: 1e-4 + gain: '10' + iir_update_decim: '1' + max_gain: '10000' + maxoutbuf: '0' + minoutbuf: '0' + reference: '0.1' + type: complex + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1104, 454] + rotation: 0 + state: enabled +- name: analog_pwr_squelch_xx_0 + id: analog_pwr_squelch_xx + parameters: + affinity: '' + alias: '' + alpha: '0.1' + comment: '' + gate: 'False' + maxoutbuf: '0' + minoutbuf: '0' + ramp: '0' + threshold: squelch_dB + type: complex + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [952, 469] + rotation: 0 + state: enabled +- name: analog_pwr_squelch_xx_0_0 + id: analog_pwr_squelch_xx + parameters: + affinity: '' + alias: '' + alpha: '0.1' + comment: '' + gate: 'True' + maxoutbuf: '0' + minoutbuf: '0' + ramp: '0' + threshold: '-200' + type: float + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [480, 613] + rotation: 180 + state: enabled +- name: audio_sink_0 + id: audio_sink + parameters: + affinity: '' + alias: '' + comment: '' + device_name: '' + num_inputs: '1' + ok_to_block: 'True' + samp_rate: '16000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [480, 715] + rotation: 180 + state: enabled +- name: blocks_complex_to_mag_0 + id: blocks_complex_to_mag + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1128, 641] + rotation: 180 + state: enabled +- name: blocks_complex_to_mag_squared_0 + id: blocks_complex_to_mag_squared + parameters: + affinity: '' + alias: '' + comment: Compute power + maxoutbuf: '0' + minoutbuf: '0' + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [888, 204] + rotation: 0 + state: enabled +- name: blocks_integrate_xx_0 + id: blocks_integrate_xx + parameters: + affinity: '' + alias: '' + comment: Video average down to 10 FFT/sec + decim: '100' + maxoutbuf: '0' + minoutbuf: '0' + type: float + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1080, 197] + rotation: 0 + state: enabled +- name: blocks_keep_one_in_n_0 + id: blocks_keep_one_in_n + parameters: + affinity: '' + alias: '' + comment: 'Want about 1000 FFT/sec + + Keep 1 in 4 vectors' + maxoutbuf: '0' + minoutbuf: '0' + n: int(round(samp_rate/fft_length/1000)) + type: complex + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [472, 197] + rotation: 0 + state: enabled +- name: blocks_nlog10_ff_0 + id: blocks_nlog10_ff + parameters: + affinity: '' + alias: '' + comment: '' + k: '0' + maxoutbuf: '0' + minoutbuf: '0' + n: '10' + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1096, 54] + rotation: 180 + state: enabled +- name: blocks_probe_signal_vx_0 + id: blocks_probe_signal_vx + parameters: + affinity: '' + alias: '' + comment: '' + type: float + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [896, 124] + rotation: 180 + state: enabled +- name: blocks_stream_to_vector_0 + id: blocks_stream_to_vector + parameters: + affinity: '' + alias: '' + comment: 'Example: + + 1024 length FFT + + 4 Msps / 1024 = 3906.25 Hz/bin + + Also 3902.25 vec/sec' + maxoutbuf: '0' + minoutbuf: '0' + num_items: fft_length + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [256, 204] + rotation: 0 + state: enabled +- name: blocks_vector_to_stream_0 + id: blocks_vector_to_stream + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_items: fft_length + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [928, 68] + rotation: 180 + state: enabled +- name: blocks_wavfile_sink_0 + id: blocks_wavfile_sink + parameters: + affinity: '' + alias: '' + append: 'False' + bits_per_sample1: FORMAT_PCM_16 + bits_per_sample2: FORMAT_PCM_16 + bits_per_sample3: FORMAT_VORBIS + bits_per_sample4: FORMAT_PCM_16 + comment: '' + file: file_name + format: FORMAT_WAV + nchan: '1' + samp_rate: '16000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [304, 620] + rotation: 180 + state: enabled +- name: fft_vxx_0 + id: fft_vxx + parameters: + affinity: '' + alias: '' + comment: '' + fft_size: fft_length + forward: 'True' + maxoutbuf: '0' + minoutbuf: '0' + nthreads: '1' + shift: 'True' + type: complex + window: window.blackmanharris(fft_length) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [656, 176] + rotation: 0 + state: enabled +- name: fir_filter_xxx_0 + id: fir_filter_xxx + parameters: + affinity: '' + alias: '' + comment: samp_rate/5 to samp_rate/25 + decim: initial_decim + maxoutbuf: '0' + minoutbuf: '0' + samp_delay: '0' + taps: variable_low_pass_filter_taps_0 + type: ccc + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [488, 485] + rotation: 0 + state: enabled +- name: fir_filter_xxx_0_0 + id: fir_filter_xxx + parameters: + affinity: '' + alias: '' + comment: samp_rate/100 to 40-80 ksps + decim: int(samp_rate/1E6) + maxoutbuf: '0' + minoutbuf: '0' + samp_delay: '0' + taps: variable_low_pass_filter_taps_0 + type: ccc + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [688, 485] + rotation: 0 + state: enabled +- name: fir_filter_xxx_0_1 + id: fir_filter_xxx + parameters: + affinity: '' + alias: '' + comment: 40-80 ksps to 8-16 ksps + decim: initial_decim + maxoutbuf: '0' + minoutbuf: '0' + samp_delay: '0' + taps: variable_low_pass_filter_taps_0 + type: fff + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [920, 628] + rotation: 180 + state: enabled +- name: freq_xlating_fir_filter_xxx_0 + id: freq_xlating_fir_filter_xxx + parameters: + affinity: '' + alias: '' + center_freq: demod_bb_freq + comment: samp_rate to samp_rate/5 + decim: initial_decim + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: samp_rate + taps: variable_low_pass_filter_taps_0 + type: ccc + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [248, 471] + rotation: 0 + state: enabled +- name: import_0 + id: import + parameters: + alias: '' + comment: '' + imports: import numpy as np + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [192, 12] + rotation: 0 + state: enabled +- name: osmosdr_source_0 + id: osmosdr_source + parameters: + affinity: '' + alias: '' + ant0: '' + ant1: '' + ant10: '' + ant11: '' + ant12: '' + ant13: '' + ant14: '' + ant15: '' + ant16: '' + ant17: '' + ant18: '' + ant19: '' + ant2: '' + ant20: '' + ant21: '' + ant22: '' + ant23: '' + ant24: '' + ant25: '' + ant26: '' + ant27: '' + ant28: '' + ant29: '' + ant3: '' + ant30: '' + ant31: '' + ant4: '' + ant5: '' + ant6: '' + ant7: '' + ant8: '' + ant9: '' + args: uhd + bb_gain0: '20' + bb_gain1: '20' + bb_gain10: '20' + bb_gain11: '20' + bb_gain12: '20' + bb_gain13: '20' + bb_gain14: '20' + bb_gain15: '20' + bb_gain16: '20' + bb_gain17: '20' + bb_gain18: '20' + bb_gain19: '20' + bb_gain2: '20' + bb_gain20: '20' + bb_gain21: '20' + bb_gain22: '20' + bb_gain23: '20' + bb_gain24: '20' + bb_gain25: '20' + bb_gain26: '20' + bb_gain27: '20' + bb_gain28: '20' + bb_gain29: '20' + bb_gain3: '20' + bb_gain30: '20' + bb_gain31: '20' + bb_gain4: '20' + bb_gain5: '20' + bb_gain6: '20' + bb_gain7: '20' + bb_gain8: '20' + bb_gain9: '20' + bw0: samp_rate*0.8 + bw1: '0' + bw10: '0' + bw11: '0' + bw12: '0' + bw13: '0' + bw14: '0' + bw15: '0' + bw16: '0' + bw17: '0' + bw18: '0' + bw19: '0' + bw2: '0' + bw20: '0' + bw21: '0' + bw22: '0' + bw23: '0' + bw24: '0' + bw25: '0' + bw26: '0' + bw27: '0' + bw28: '0' + bw29: '0' + bw3: '0' + bw30: '0' + bw31: '0' + bw4: '0' + bw5: '0' + bw6: '0' + bw7: '0' + bw8: '0' + bw9: '0' + clock_source0: '' + clock_source1: '' + clock_source2: '' + clock_source3: '' + clock_source4: '' + clock_source5: '' + clock_source6: '' + clock_source7: '' + comment: '' + corr0: '0' + corr1: '0' + corr10: '0' + corr11: '0' + corr12: '0' + corr13: '0' + corr14: '0' + corr15: '0' + corr16: '0' + corr17: '0' + corr18: '0' + corr19: '0' + corr2: '0' + corr20: '0' + corr21: '0' + corr22: '0' + corr23: '0' + corr24: '0' + corr25: '0' + corr26: '0' + corr27: '0' + corr28: '0' + corr29: '0' + corr3: '0' + corr30: '0' + corr31: '0' + corr4: '0' + corr5: '0' + corr6: '0' + corr7: '0' + corr8: '0' + corr9: '0' + dc_offset_mode0: '0' + dc_offset_mode1: '0' + dc_offset_mode10: '0' + dc_offset_mode11: '0' + dc_offset_mode12: '0' + dc_offset_mode13: '0' + dc_offset_mode14: '0' + dc_offset_mode15: '0' + dc_offset_mode16: '0' + dc_offset_mode17: '0' + dc_offset_mode18: '0' + dc_offset_mode19: '0' + dc_offset_mode2: '0' + dc_offset_mode20: '0' + dc_offset_mode21: '0' + dc_offset_mode22: '0' + dc_offset_mode23: '0' + dc_offset_mode24: '0' + dc_offset_mode25: '0' + dc_offset_mode26: '0' + dc_offset_mode27: '0' + dc_offset_mode28: '0' + dc_offset_mode29: '0' + dc_offset_mode3: '0' + dc_offset_mode30: '0' + dc_offset_mode31: '0' + dc_offset_mode4: '0' + dc_offset_mode5: '0' + dc_offset_mode6: '0' + dc_offset_mode7: '0' + dc_offset_mode8: '0' + dc_offset_mode9: '0' + freq0: center_freq + freq1: 100e6 + freq10: 100e6 + freq11: 100e6 + freq12: 100e6 + freq13: 100e6 + freq14: 100e6 + freq15: 100e6 + freq16: 100e6 + freq17: 100e6 + freq18: 100e6 + freq19: 100e6 + freq2: 100e6 + freq20: 100e6 + freq21: 100e6 + freq22: 100e6 + freq23: 100e6 + freq24: 100e6 + freq25: 100e6 + freq26: 100e6 + freq27: 100e6 + freq28: 100e6 + freq29: 100e6 + freq3: 100e6 + freq30: 100e6 + freq31: 100e6 + freq4: 100e6 + freq5: 100e6 + freq6: 100e6 + freq7: 100e6 + freq8: 100e6 + freq9: 100e6 + gain0: gain_db + gain1: '10' + gain10: '10' + gain11: '10' + gain12: '10' + gain13: '10' + gain14: '10' + gain15: '10' + gain16: '10' + gain17: '10' + gain18: '10' + gain19: '10' + gain2: '10' + gain20: '10' + gain21: '10' + gain22: '10' + gain23: '10' + gain24: '10' + gain25: '10' + gain26: '10' + gain27: '10' + gain28: '10' + gain29: '10' + gain3: '10' + gain30: '10' + gain31: '10' + gain4: '10' + gain5: '10' + gain6: '10' + gain7: '10' + gain8: '10' + gain9: '10' + gain_mode0: 'False' + gain_mode1: 'False' + gain_mode10: 'False' + gain_mode11: 'False' + gain_mode12: 'False' + gain_mode13: 'False' + gain_mode14: 'False' + gain_mode15: 'False' + gain_mode16: 'False' + gain_mode17: 'False' + gain_mode18: 'False' + gain_mode19: 'False' + gain_mode2: 'False' + gain_mode20: 'False' + gain_mode21: 'False' + gain_mode22: 'False' + gain_mode23: 'False' + gain_mode24: 'False' + gain_mode25: 'False' + gain_mode26: 'False' + gain_mode27: 'False' + gain_mode28: 'False' + gain_mode29: 'False' + gain_mode3: 'False' + gain_mode30: 'False' + gain_mode31: 'False' + gain_mode4: 'False' + gain_mode5: 'False' + gain_mode6: 'False' + gain_mode7: 'False' + gain_mode8: 'False' + gain_mode9: 'False' + if_gain0: '20' + if_gain1: '20' + if_gain10: '20' + if_gain11: '20' + if_gain12: '20' + if_gain13: '20' + if_gain14: '20' + if_gain15: '20' + if_gain16: '20' + if_gain17: '20' + if_gain18: '20' + if_gain19: '20' + if_gain2: '20' + if_gain20: '20' + if_gain21: '20' + if_gain22: '20' + if_gain23: '20' + if_gain24: '20' + if_gain25: '20' + if_gain26: '20' + if_gain27: '20' + if_gain28: '20' + if_gain29: '20' + if_gain3: '20' + if_gain30: '20' + if_gain31: '20' + if_gain4: '20' + if_gain5: '20' + if_gain6: '20' + if_gain7: '20' + if_gain8: '20' + if_gain9: '20' + iq_balance_mode0: '0' + iq_balance_mode1: '0' + iq_balance_mode10: '0' + iq_balance_mode11: '0' + iq_balance_mode12: '0' + iq_balance_mode13: '0' + iq_balance_mode14: '0' + iq_balance_mode15: '0' + iq_balance_mode16: '0' + iq_balance_mode17: '0' + iq_balance_mode18: '0' + iq_balance_mode19: '0' + iq_balance_mode2: '0' + iq_balance_mode20: '0' + iq_balance_mode21: '0' + iq_balance_mode22: '0' + iq_balance_mode23: '0' + iq_balance_mode24: '0' + iq_balance_mode25: '0' + iq_balance_mode26: '0' + iq_balance_mode27: '0' + iq_balance_mode28: '0' + iq_balance_mode29: '0' + iq_balance_mode3: '0' + iq_balance_mode30: '0' + iq_balance_mode31: '0' + iq_balance_mode4: '0' + iq_balance_mode5: '0' + iq_balance_mode6: '0' + iq_balance_mode7: '0' + iq_balance_mode8: '0' + iq_balance_mode9: '0' + maxoutbuf: '0' + minoutbuf: '0' + nchan: '1' + num_mboards: '1' + sample_rate: samp_rate + sync: sync + time_source0: '' + time_source1: '' + time_source2: '' + time_source3: '' + time_source4: '' + time_source5: '' + time_source6: '' + time_source7: '' + type: fc32 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 92] + rotation: 0 + state: enabled +- name: pfb_arb_resampler_xxx_0 + id: pfb_arb_resampler_xxx + parameters: + affinity: '' + alias: '' + atten: '100' + comment: Note this is set for 16 kHz (not 8 kHz) + maxoutbuf: '0' + minoutbuf: '0' + nfilts: '32' + rrate: 16E3/float(final_rate/5) + samp_delay: '0' + taps: '' + type: fff + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [672, 613] + rotation: 180 + state: enabled +- name: qtgui_freq_sink_x_0 + id: qtgui_freq_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + average: '1.0' + axislabels: 'True' + bw: samp_rate + color1: '"blue"' + color10: '"dark blue"' + color2: '"red"' + color3: '"green"' + color4: '"black"' + color5: '"cyan"' + color6: '"magenta"' + color7: '"yellow"' + color8: '"dark red"' + color9: '"dark green"' + comment: '' + ctrlpanel: 'False' + fc: 144E6 + fftsize: fft_length + freqhalf: 'True' + grid: 'False' + gui_hint: 0,0,3,1 + label: Relative Gain + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '"Spectrum"' + nconnections: '1' + norm_window: 'False' + showports: 'True' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_tag: '""' + type: complex + units: dB + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + wintype: window.WIN_BLACKMAN_hARRIS + ymax: '-20' + ymin: '-120' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [272, 111] + rotation: 0 + state: enabled +- name: qtgui_freq_sink_x_0_0 + id: qtgui_freq_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + average: '1.0' + axislabels: 'True' + bw: final_rate + color1: '"blue"' + color10: '"dark blue"' + color2: '"red"' + color3: '"green"' + color4: '"black"' + color5: '"cyan"' + color6: '"magenta"' + color7: '"yellow"' + color8: '"dark red"' + color9: '"dark green"' + comment: '' + ctrlpanel: 'False' + fc: '0' + fftsize: '1024' + freqhalf: 'True' + grid: 'False' + gui_hint: 3,0,3,1 + label: Relative Gain + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '"Decimated Channel"' + nconnections: '1' + norm_window: 'False' + showports: 'True' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_tag: '""' + type: complex + units: dB + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + wintype: window.WIN_BLACKMAN_hARRIS + ymax: '-60' + ymin: '-200' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1016, 317] + rotation: 0 + state: enabled +- name: qtgui_time_sink_x_0 + id: qtgui_time_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 0,1,3,1 + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '"Averaged Spectrum"' + nconnections: '1' + size: fft_length + srate: samp_rate + stemplot: 'False' + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: float + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Power + ymax: '40' + ymin: '-60' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [704, 47] + rotation: 180 + state: enabled + +connections: +- [analog_agc3_xx_0, '0', blocks_complex_to_mag_0, '0'] +- [analog_pwr_squelch_xx_0, '0', analog_agc3_xx_0, '0'] +- [analog_pwr_squelch_xx_0_0, '0', blocks_wavfile_sink_0, '0'] +- [blocks_complex_to_mag_0, '0', fir_filter_xxx_0_1, '0'] +- [blocks_complex_to_mag_squared_0, '0', blocks_integrate_xx_0, '0'] +- [blocks_integrate_xx_0, '0', blocks_nlog10_ff_0, '0'] +- [blocks_keep_one_in_n_0, '0', fft_vxx_0, '0'] +- [blocks_nlog10_ff_0, '0', blocks_probe_signal_vx_0, '0'] +- [blocks_nlog10_ff_0, '0', blocks_vector_to_stream_0, '0'] +- [blocks_stream_to_vector_0, '0', blocks_keep_one_in_n_0, '0'] +- [blocks_vector_to_stream_0, '0', qtgui_time_sink_x_0, '0'] +- [fft_vxx_0, '0', blocks_complex_to_mag_squared_0, '0'] +- [fir_filter_xxx_0, '0', fir_filter_xxx_0_0, '0'] +- [fir_filter_xxx_0_0, '0', analog_pwr_squelch_xx_0, '0'] +- [fir_filter_xxx_0_0, '0', qtgui_freq_sink_x_0_0, '0'] +- [fir_filter_xxx_0_1, '0', pfb_arb_resampler_xxx_0, '0'] +- [freq_xlating_fir_filter_xxx_0, '0', fir_filter_xxx_0, '0'] +- [osmosdr_source_0, '0', blocks_stream_to_vector_0, '0'] +- [osmosdr_source_0, '0', freq_xlating_fir_filter_xxx_0, '0'] +- [osmosdr_source_0, '0', qtgui_freq_sink_x_0, '0'] +- [pfb_arb_resampler_xxx_0, '0', analog_pwr_squelch_xx_0_0, '0'] +- [pfb_arb_resampler_xxx_0, '0', audio_sink_0, '0'] + +metadata: + file_format: 1 + grc_version: v3.11.0.0git-215-g9a698313 diff --git a/apps/am_flow_example.py b/apps/am_flow_example.py index 0517730..1088a7d 100755 --- a/apps/am_flow_example.py +++ b/apps/am_flow_example.py @@ -1,10 +1,15 @@ -#!/usr/bin/env python2 -################################################## +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# +# SPDX-License-Identifier: GPL-3.0 +# # GNU Radio Python Flow Graph # Title: Ham2Mon AM Receiver Flow Example # Description: Example of GR DSP flow in receiver.py -# Generated: Sun Aug 16 20:36:43 2015 -################################################## +# GNU Radio version: v3.11.0.0git-215-g9a698313 + +from packaging.version import Version as StrictVersion if __name__ == '__main__': import ctypes @@ -14,40 +19,46 @@ x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: - print "Warning: failed to XInitThreads()" + print("Warning: failed to XInitThreads()") -from PyQt4 import Qt +from PyQt5 import Qt +from gnuradio import qtgui +from gnuradio.filter import firdes +import sip from gnuradio import analog from gnuradio import audio from gnuradio import blocks -from gnuradio import eng_notation from gnuradio import fft +from gnuradio.fft import window from gnuradio import filter from gnuradio import gr -from gnuradio import qtgui -from gnuradio.eng_option import eng_option -from gnuradio.fft import window -from gnuradio.filter import firdes +import sys +import signal +from argparse import ArgumentParser +from gnuradio.eng_arg import eng_float, intx +from gnuradio import eng_notation from gnuradio.filter import pfb -from gnuradio.qtgui import Range, RangeWidget -from optparse import OptionParser +from gnuradio.qtgui import Range, GrRangeWidget +from PyQt5 import QtCore import numpy as np import osmosdr -import sip -import sys import time + +from gnuradio import qtgui + class am_flow_example(gr.top_block, Qt.QWidget): def __init__(self): - gr.top_block.__init__(self, "Ham2Mon AM Receiver Flow Example") + gr.top_block.__init__(self, "Ham2Mon AM Receiver Flow Example", catch_exceptions=True) Qt.QWidget.__init__(self) self.setWindowTitle("Ham2Mon AM Receiver Flow Example") + qtgui.util.check_set_qss() try: - self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) + self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: - pass + pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() @@ -61,7 +72,14 @@ def __init__(self): self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "am_flow_example") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) + + try: + if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + self.restoreGeometry(self.settings.value("geometry").toByteArray()) + else: + self.restoreGeometry(self.settings.value("geometry")) + except: + pass ################################################## # Variables @@ -70,15 +88,9 @@ def __init__(self): self.initial_decim = initial_decim = 5 self.samp_ratio = samp_ratio = samp_rate/1E6 self.final_rate = final_rate = samp_rate/initial_decim**2/int(samp_rate/1E6) - - self.variable_low_pass_filter_taps_2 = variable_low_pass_filter_taps_2 = firdes.low_pass(1.0, final_rate, 3500, 500, firdes.WIN_HAMMING, 6.76) - - - self.variable_low_pass_filter_taps_1 = variable_low_pass_filter_taps_1 = firdes.low_pass(1.0, samp_rate/25, 12.5E3, 1E3, firdes.WIN_HAMMING, 6.76) - - - self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass(1.0, 1, 0.090, 0.010, firdes.WIN_HAMMING, 6.76) - + self.variable_low_pass_filter_taps_2 = variable_low_pass_filter_taps_2 = firdes.low_pass(1.0, final_rate, 3500,500, window.WIN_HAMMING, 6.76) + self.variable_low_pass_filter_taps_1 = variable_low_pass_filter_taps_1 = firdes.low_pass(1.0, samp_rate/25, 12.5E3,1E3, window.WIN_HAMMING, 6.76) + self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass(1.0, 1, 0.090,0.010, window.WIN_HAMMING, 6.76) self.squelch_dB = squelch_dB = -70 self.gain_db = gain_db = 30 self.final_decim = final_decim = int(samp_rate/1E6) @@ -91,48 +103,68 @@ def __init__(self): # Blocks ################################################## self._squelch_dB_range = Range(-100, 0, 5, -70, 200) - self._squelch_dB_win = RangeWidget(self._squelch_dB_range, self.set_squelch_dB, "Squelch (dB)", "counter_slider", float) - self.top_grid_layout.addWidget(self._squelch_dB_win, 5,1,1,3) + self._squelch_dB_win = GrRangeWidget(self._squelch_dB_range, self.set_squelch_dB, "Squelch (dB)", "counter_slider", float, QtCore.Qt.Horizontal, "value") + self.squelch_dB = self._squelch_dB_win + + self.top_grid_layout.addWidget(self._squelch_dB_win, 5, 1, 1, 3) + for r in range(5, 6): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(1, 4): + self.top_grid_layout.setColumnStretch(c, 1) self._gain_db_range = Range(0, 70, 1, 30, 200) - self._gain_db_win = RangeWidget(self._gain_db_range, self.set_gain_db, "HW Gain (dB)", "counter_slider", float) - self.top_grid_layout.addWidget(self._gain_db_win, 4,1,1,3) + self._gain_db_win = GrRangeWidget(self._gain_db_range, self.set_gain_db, "HW Gain (dB)", "counter_slider", float, QtCore.Qt.Horizontal, "value") + self.gain_db = self._gain_db_win + + self.top_grid_layout.addWidget(self._gain_db_win, 4, 1, 1, 3) + for r in range(4, 5): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(1, 4): + self.top_grid_layout.setColumnStretch(c, 1) self._demod_bb_freq_range = Range(-samp_rate/2, samp_rate/2, 5E3, 390E3, 200) - self._demod_bb_freq_win = RangeWidget(self._demod_bb_freq_range, self.set_demod_bb_freq, "Demod BB Freq (Hz)", "counter_slider", float) - self.top_grid_layout.addWidget(self._demod_bb_freq_win, 3,1,1,3) + self._demod_bb_freq_win = GrRangeWidget(self._demod_bb_freq_range, self.set_demod_bb_freq, "Demod BB Freq (Hz)", "counter_slider", float, QtCore.Qt.Horizontal, "value") + self.demod_bb_freq = self._demod_bb_freq_win + + self.top_grid_layout.addWidget(self._demod_bb_freq_win, 3, 1, 1, 3) + for r in range(3, 4): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(1, 4): + self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( - fft_length, #size - samp_rate, #samp_rate - "Averaged Spectrum", #name - 1 #number of inputs + fft_length, #size + samp_rate, #samp_rate + "Averaged Spectrum", #name + 1, #number of inputs + None # parent ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-60, 40) - - self.qtgui_time_sink_x_0.set_y_label("Power", "") - - self.qtgui_time_sink_x_0.enable_tags(-1, True) + + self.qtgui_time_sink_x_0.set_y_label('Power', "") + + self.qtgui_time_sink_x_0.enable_tags(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) + self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) - - if not True: - self.qtgui_time_sink_x_0.disable_legend() - - labels = ["", "", "", "", "", - "", "", "", "", ""] + self.qtgui_time_sink_x_0.enable_stem_plot(False) + + + labels = ['', '', '', '', '', + '', '', '', '', ''] widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "blue"] + 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] styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] + 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - 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(1): + -1, -1, -1, -1, -1] + + + for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: @@ -142,40 +174,45 @@ def __init__(self): self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0,1,3,1) + + self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.qwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0, 1, 3, 1) + for r in range(0, 3): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(1, 2): + self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - final_rate, #bw - "Decimated Channel", #name - 1 #number of inputs + 1024, #size + window.WIN_BLACKMAN_hARRIS, #wintype + 0, #fc + final_rate, #bw + "Decimated Channel", #name + 1, + None # parent ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) - self.qtgui_freq_sink_x_0_0.set_y_axis(-200, -60) + self.qtgui_freq_sink_x_0_0.set_y_axis((-200), (-60)) + 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(False) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) + 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 complex == type(float()): - self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True) - - labels = ["", "", "", "", "", - "", "", "", "", ""] + self.qtgui_freq_sink_x_0_0.set_fft_window_normalized(False) + + + + labels = ['', '', '', '', '', + '', '', '', '', ''] widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] + 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] + "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(1): + 1.0, 1.0, 1.0, 1.0, 1.0] + + for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: @@ -183,40 +220,45 @@ def __init__(self): 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, 3,0,3,1) + + self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.qwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 3, 0, 3, 1) + for r in range(3, 6): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(0, 1): + self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( - fft_length, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 144E6, #fc - samp_rate, #bw - "Spectrum", #name - 1 #number of inputs + fft_length, #size + window.WIN_BLACKMAN_hARRIS, #wintype + 144E6, #fc + samp_rate, #bw + "Spectrum", #name + 1, + None # parent ) self.qtgui_freq_sink_x_0.set_update_time(0.10) - self.qtgui_freq_sink_x_0.set_y_axis(-120, -20) + self.qtgui_freq_sink_x_0.set_y_axis((-120), (-20)) + self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) + self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) - - if not True: - self.qtgui_freq_sink_x_0.disable_legend() - - if complex == type(float()): - self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) - - labels = ["", "", "", "", "", - "", "", "", "", ""] + self.qtgui_freq_sink_x_0.set_fft_window_normalized(False) + + + + labels = ['', '', '', '', '', + '', '', '', '', ''] widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] + 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] + "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(1): + 1.0, 1.0, 1.0, 1.0, 1.0] + + for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: @@ -224,16 +266,22 @@ def __init__(self): self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) 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, 0,0,3,1) + + self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.qwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 3, 1) + for r in range(0, 3): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(0, 1): + self.top_grid_layout.setColumnStretch(c, 1) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff( - 16E3/float(final_rate/5), - taps=None, - flt_size=32) + (16E3/float(final_rate/5)), + taps=None, + flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) - - self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "uhd" ) + self.osmosdr_source_0 = osmosdr.source( + args="numchan=" + str(1) + " " + 'uhd' + ) + self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(center_freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) @@ -243,61 +291,72 @@ def __init__(self): self.osmosdr_source_0.set_gain(gain_db, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) - self.osmosdr_source_0.set_antenna("", 0) - self.osmosdr_source_0.set_bandwidth(samp_rate*0.8, 0) - - self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(initial_decim, (variable_low_pass_filter_taps_0), demod_bb_freq, samp_rate) - self.fir_filter_xxx_0_1 = filter.fir_filter_fff(initial_decim, (variable_low_pass_filter_taps_0)) + self.osmosdr_source_0.set_antenna('', 0) + self.osmosdr_source_0.set_bandwidth((samp_rate*0.8), 0) + self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(initial_decim, variable_low_pass_filter_taps_0, demod_bb_freq, samp_rate) + self.fir_filter_xxx_0_1 = filter.fir_filter_fff(initial_decim, variable_low_pass_filter_taps_0) self.fir_filter_xxx_0_1.declare_sample_delay(0) - self.fir_filter_xxx_0_0 = filter.fir_filter_ccc(int(samp_rate/1E6), (variable_low_pass_filter_taps_0)) + self.fir_filter_xxx_0_0 = filter.fir_filter_ccc((int(samp_rate/1E6)), variable_low_pass_filter_taps_0) self.fir_filter_xxx_0_0.declare_sample_delay(0) - self.fir_filter_xxx_0 = filter.fir_filter_ccc(initial_decim, (variable_low_pass_filter_taps_0)) + self.fir_filter_xxx_0 = filter.fir_filter_ccc(initial_decim, variable_low_pass_filter_taps_0) self.fir_filter_xxx_0.declare_sample_delay(0) - self.fft_vxx_0 = fft.fft_vcc(fft_length, True, (window.blackmanharris(fft_length)), True, 1) - self.blocks_wavfile_sink_0 = blocks.wavfile_sink(file_name, 1, 16000, 8) + self.fft_vxx_0 = fft.fft_vcc(fft_length, True, window.blackmanharris(fft_length), True, 1) + self.blocks_wavfile_sink_0 = blocks.wavfile_sink( + file_name, + 1, + 16000, + blocks.FORMAT_WAV, + blocks.FORMAT_PCM_16, + False + ) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, fft_length) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_length) self.blocks_probe_signal_vx_0 = blocks.probe_signal_vf(fft_length) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, fft_length, 0) - self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*fft_length, int(round(samp_rate/fft_length/1000))) + self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*fft_length, (int(round(samp_rate/fft_length/1000)))) self.blocks_integrate_xx_0 = blocks.integrate_ff(100, fft_length) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_length) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) - self.audio_sink_0 = audio.sink(16000, "", True) - self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_ff(-200, 0.1, 0, True) + self.audio_sink_0 = audio.sink(16000, '', True) + self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_ff((-200), 0.1, 0, True) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(squelch_dB, 0.1, 0, False) - self.analog_agc3_xx_0 = analog.agc3_cc(1e-0, 1e-4, 0.1, 10, 1) + self.analog_agc3_xx_0 = analog.agc3_cc((1e-0), (1e-4), 0.1, 10, 1) self.analog_agc3_xx_0.set_max_gain(10000) + ################################################## # Connections ################################################## - self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) - self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_agc3_xx_0, 0)) - self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.blocks_wavfile_sink_0, 0)) - self.connect((self.blocks_complex_to_mag_0, 0), (self.fir_filter_xxx_0_1, 0)) - self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0)) - self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) - self.connect((self.blocks_keep_one_in_n_0, 0), (self.fft_vxx_0, 0)) - self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_probe_signal_vx_0, 0)) - self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_vector_to_stream_0, 0)) - self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_keep_one_in_n_0, 0)) - self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_0, 0)) - self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) - self.connect((self.fir_filter_xxx_0, 0), (self.fir_filter_xxx_0_0, 0)) - self.connect((self.fir_filter_xxx_0_0, 0), (self.analog_pwr_squelch_xx_0, 0)) - self.connect((self.fir_filter_xxx_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) - self.connect((self.fir_filter_xxx_0_1, 0), (self.pfb_arb_resampler_xxx_0, 0)) - self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) - self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_pwr_squelch_xx_0_0, 0)) - self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.audio_sink_0, 0)) + self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) + self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_agc3_xx_0, 0)) + self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.blocks_wavfile_sink_0, 0)) + self.connect((self.blocks_complex_to_mag_0, 0), (self.fir_filter_xxx_0_1, 0)) + self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0)) + self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) + self.connect((self.blocks_keep_one_in_n_0, 0), (self.fft_vxx_0, 0)) + self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_probe_signal_vx_0, 0)) + self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_vector_to_stream_0, 0)) + self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_keep_one_in_n_0, 0)) + self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_0, 0)) + self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) + self.connect((self.fir_filter_xxx_0, 0), (self.fir_filter_xxx_0_0, 0)) + self.connect((self.fir_filter_xxx_0_0, 0), (self.analog_pwr_squelch_xx_0, 0)) + self.connect((self.fir_filter_xxx_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) + self.connect((self.fir_filter_xxx_0_1, 0), (self.pfb_arb_resampler_xxx_0, 0)) + self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0, 0)) + self.connect((self.osmosdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) + self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) + self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) + self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_pwr_squelch_xx_0_0, 0)) + self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.audio_sink_0, 0)) + def closeEvent(self, event): self.settings = Qt.QSettings("GNU Radio", "am_flow_example") self.settings.setValue("geometry", self.saveGeometry()) + self.stop() + self.wait() + event.accept() def get_samp_rate(self): @@ -308,9 +367,10 @@ def set_samp_rate(self, samp_rate): self.set_final_decim(int(self.samp_rate/1E6)) self.set_final_rate(self.samp_rate/self.initial_decim**2/int(self.samp_rate/1E6)) self.set_samp_ratio(self.samp_rate/1E6) - self.blocks_keep_one_in_n_0.set_n(int(round(self.samp_rate/self.fft_length/1000))) + self.set_variable_low_pass_filter_taps_1(firdes.low_pass(1.0, self.samp_rate/25, 12.5E3, 1E3, window.WIN_HAMMING, 6.76)) + self.blocks_keep_one_in_n_0.set_n((int(round(self.samp_rate/self.fft_length/1000)))) self.osmosdr_source_0.set_sample_rate(self.samp_rate) - self.osmosdr_source_0.set_bandwidth(self.samp_rate*0.8, 0) + self.osmosdr_source_0.set_bandwidth((self.samp_rate*0.8), 0) self.qtgui_freq_sink_x_0.set_frequency_range(144E6, self.samp_rate) self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate) @@ -333,7 +393,8 @@ def get_final_rate(self): def set_final_rate(self, final_rate): self.final_rate = final_rate - self.pfb_arb_resampler_xxx_0.set_rate(16E3/float(self.final_rate/5)) + self.set_variable_low_pass_filter_taps_2(firdes.low_pass(1.0, self.final_rate, 3500, 500, window.WIN_HAMMING, 6.76)) + self.pfb_arb_resampler_xxx_0.set_rate((16E3/float(self.final_rate/5))) self.qtgui_freq_sink_x_0_0.set_frequency_range(0, self.final_rate) def get_variable_low_pass_filter_taps_2(self): @@ -353,10 +414,10 @@ def get_variable_low_pass_filter_taps_0(self): def set_variable_low_pass_filter_taps_0(self, variable_low_pass_filter_taps_0): self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 - self.fir_filter_xxx_0.set_taps((self.variable_low_pass_filter_taps_0)) - self.fir_filter_xxx_0_0.set_taps((self.variable_low_pass_filter_taps_0)) - self.fir_filter_xxx_0_1.set_taps((self.variable_low_pass_filter_taps_0)) - self.freq_xlating_fir_filter_xxx_0.set_taps((self.variable_low_pass_filter_taps_0)) + self.fir_filter_xxx_0.set_taps(self.variable_low_pass_filter_taps_0) + self.fir_filter_xxx_0_0.set_taps(self.variable_low_pass_filter_taps_0) + self.fir_filter_xxx_0_1.set_taps(self.variable_low_pass_filter_taps_0) + self.freq_xlating_fir_filter_xxx_0.set_taps(self.variable_low_pass_filter_taps_0) def get_squelch_dB(self): return self.squelch_dB @@ -390,7 +451,7 @@ def get_fft_length(self): def set_fft_length(self, fft_length): self.fft_length = fft_length - self.blocks_keep_one_in_n_0.set_n(int(round(self.samp_rate/self.fft_length/1000))) + self.blocks_keep_one_in_n_0.set_n((int(round(self.samp_rate/self.fft_length/1000)))) def get_demod_bb_freq(self): return self.demod_bb_freq @@ -407,20 +468,35 @@ def set_center_freq(self, center_freq): self.osmosdr_source_0.set_center_freq(self.center_freq, 0) -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() - from distutils.version import StrictVersion - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): - Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster')) + + +def main(top_block_cls=am_flow_example, options=None): + + if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + style = gr.prefs().get_string('qtgui', 'style', 'raster') + Qt.QApplication.setGraphicsSystem(style) qapp = Qt.QApplication(sys.argv) - tb = am_flow_example() + + tb = top_block_cls() + tb.start() + tb.show() - def quitting(): + def sig_handler(sig=None, frame=None): tb.stop() tb.wait() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) + + Qt.QApplication.quit() + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + + timer = Qt.QTimer() + timer.start(500) + timer.timeout.connect(lambda: None) + qapp.exec_() - tb = None # to clean up Qt widgets + +if __name__ == '__main__': + main() diff --git a/apps/cursesgui.py b/apps/cursesgui.py index 2896f70..77c2b4f 100755 --- a/apps/cursesgui.py +++ b/apps/cursesgui.py @@ -89,7 +89,7 @@ def draw_spectrum(self, data): # Clear previous contents, draw border, and title self.win.clear() self.win.border(0) - self.win.addnstr(0, self.dims[1]/2-4, "SPECTRUM", 8, + self.win.addnstr(0, int(self.dims[1]/2-4), "SPECTRUM", 8, curses.color_pair(4)) # Draw the bars @@ -191,7 +191,7 @@ def draw_channels(self, gui_tuned_channels): # Clear previous contents, draw border, and title self.win.clear() self.win.border(0) - self.win.addnstr(0, self.dims[1]/2-4, "CHANNELS", 8, + self.win.addnstr(0, int(self.dims[1]/2-4), "CHANNELS", 8, curses.color_pair(4)) # Limit the displayed channels to no more than two rows @@ -247,7 +247,7 @@ def draw_channels(self, gui_lockout_channels): # Clear previous contents, draw border, and title self.win.clear() self.win.border(0) - self.win.addnstr(0, self.dims[1]/2-3, "LOCKOUT", 7, + self.win.addnstr(0, int(self.dims[1]/2-3), "LOCKOUT", 7, curses.color_pair(4)) # Draw the lockout channels @@ -354,7 +354,7 @@ def draw_rx(self): # Clear previous contents, draw border, and title self.win.clear() self.win.border(0) - self.win.addnstr(0, self.dims[1]/2-4, "RECEIVER", 8, + self.win.addnstr(0, int(self.dims[1]/2-4), "RECEIVER", 8, curses.color_pair(4)) # Draw the receiver info prefix fields @@ -380,7 +380,7 @@ def draw_rx(self): self.win.addnstr(10, 1, text, 15) # Draw the receiver info suffix fields - if self.freq_entry <> 'None': + if self.freq_entry != 'None': text = self.freq_entry else: text = '{:.3f}'.format((self.center_freq)/1E6) @@ -471,7 +471,7 @@ def proc_keyb_hard(self, keyb): pass self.freq_entry = 'None' return True - elif self.freq_entry <> 'None' and (keyb - 48 in range (10) or keyb == ord('.')): + elif self.freq_entry != 'None' and (keyb - 48 in range (10) or keyb == ord('.')): # build up frequency from 1-9 and '.' self.freq_entry = self.freq_entry + chr(keyb) return False diff --git a/apps/estimate.py b/apps/estimate.py index 1e597df..f61e96e 100755 --- a/apps/estimate.py +++ b/apps/estimate.py @@ -68,30 +68,30 @@ def main(): """ Tests the functions in this module""" # Test avg_freq() - print "Testing avg_freq()" + print("Testing avg_freq()") data = np.array([0, 1, 1, 0]) - print "Input spectrum data is " + str(data) + print("Input spectrum data is " + str(data)) result = avg_freq(data) - print "Average frequency is " + str(result) + print("Average frequency is " + str(result)) if result == 1.5: - print "Test Pass" + print("Test Pass") else: - print "Test Fail" - print "" + print("Test Fail") + print("") # Test channel_estimate() - print "Testing channel_estimate()" + print("Testing channel_estimate()") data = np.array([0, 1, 1, 0, 0, 1, 1, 1]) threshold = 0.5 - print "Input spectrum data is " + str(data) - print "Threshold is " + str(threshold) + print("Input spectrum data is " + str(data)) + print("Threshold is " + str(threshold)) result = channel_estimate(data, threshold) - print "Channels at " + str(result) + print("Channels at " + str(result)) if result == [1.5, 6.0]: - print "Test Pass" + print("Test Pass") else: - print "Test Fail" - print "" + print("Test Fail") + print("") if __name__ == '__main__': diff --git a/apps/ham2mon.py b/apps/ham2mon.py index 3e2d810..9536d19 100755 --- a/apps/ham2mon.py +++ b/apps/ham2mon.py @@ -142,13 +142,13 @@ def main(screen): PARSER = parser.CLParser() if len(PARSER.parser_args) != 0: PARSER.print_help() #pylint: disable=maybe-no-member - raise SystemExit, 1 + raise(SystemExit, 1) else: curses.wrapper(main) except KeyboardInterrupt: pass - except RuntimeError: - print "" - print "RuntimeError: SDR hardware not detected or insufficient USB permissions. Try running as root." - print "" + except RuntimeError as err: + print(err) + print("RuntimeError: SDR hardware not detected or insufficient USB permissions. Try running as root.") + print("") diff --git a/apps/nbfm_flow_example.grc b/apps/nbfm_flow_example.grc index 32acca4..9fa14c5 100644 --- a/apps/nbfm_flow_example.grc +++ b/apps/nbfm_flow_example.grc @@ -1,4065 +1,1253 @@ - - - - Fri Jul 3 12:44:24 2015 - - options - - author - - - - alias - - - - window_size - 1280, 1024 - - - category - Custom - - - comment - - - - description - Example of GR DSP flow in receiver.py - - - _enabled - True - - - _coordinate - (8, 7) - - - _rotation - 0 - - - generate_options - qt_gui - - - id - nbfm_flow_example - - - max_nouts - 0 - - - realtime_scheduling - - - - run_options - prompt - - - run - True - - - thread_safe_setters - - - - title - Ham2Mon NBFM Receiver Flow Example - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (16, 285) - - - _rotation - 0 - - - id - center_freq - - - value - 144E6 - - - - variable_qtgui_range - - comment - - - - value - 390E3 - - - _enabled - True - - - _coordinate - (24, 385) - - - gui_hint - 3,1,1,3 - - - _rotation - 0 - - - id - demod_bb_freq - - - label - "Demod BB Freq (Hz)" - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - -samp_rate/2 - - - step - 5E3 - - - stop - samp_rate/2 - - - rangeType - float - - - widget - counter_slider - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (464, 13) - - - _rotation - 0 - - - id - fft_length - - - value - 256 * int(pow(2, np.ceil(np.log(samp_ratio)/np.log(2)))) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (360, 701) - - - _rotation - 0 - - - id - file_name - - - value - "test.wav" - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (832, 333) - - - _rotation - 0 - - - id - final_decim - - - value - int(samp_rate/1E6) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (832, 397) - - - _rotation - 0 - - - id - final_rate - - - value - samp_rate/initial_decim**2/int(samp_rate/1E6) - - - - variable_qtgui_range - - comment - - - - value - 30 - - - _enabled - True - - - _coordinate - (568, 9) - - - gui_hint - 4,1,1,3 - - - _rotation - 0 - - - id - gain_db - - - label - "HW Gain (dB)" - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - 0 - - - step - 1 - - - stop - 70 - - - rangeType - float - - - widget - counter_slider - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (432, 405) - - - _rotation - 0 - - - id - initial_decim - - - value - 5 - - - - variable - - comment - 1E6 minimum - - - _enabled - True - - - _coordinate - (272, 13) - - - _rotation - 0 - - - id - samp_rate - - - value - 1E6 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (368, 13) - - - _rotation - 0 - - - id - samp_ratio - - - value - samp_rate/1E6 - - - - variable_qtgui_range - - comment - - - - value - -70 - - - _enabled - True - - - _coordinate - (752, 721) - - - gui_hint - 5,1,1,3 - - - _rotation - 0 - - - id - squelch_dB - - - label - "Squelch (dB)" - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - -100 - - - step - 5 - - - stop - 0 - - - rangeType - float - - - widget - counter_slider - - - - variable_low_pass_filter_taps - - beta - 6.76 - - - comment - - - - cutoff_freq - 0.090 - - - _enabled - True - - - _coordinate - (248, 338) - - - _rotation - 0 - - - gain - 1.0 - - - id - variable_low_pass_filter_taps_0 - - - samp_rate - 1 - - - width - 0.010 - - - win - firdes.WIN_HAMMING - - - - variable_low_pass_filter_taps - - beta - 6.76 - - - comment - - - - cutoff_freq - 12.5E3 - - - _enabled - True - - - _coordinate - (664, 330) - - - _rotation - 0 - - - gain - 1.0 - - - id - variable_low_pass_filter_taps_1 - - - samp_rate - samp_rate/25 - - - width - 1E3 - - - win - firdes.WIN_HAMMING - - - - variable_low_pass_filter_taps - - beta - 6.76 - - - comment - - - - cutoff_freq - 3500 - - - _enabled - True - - - _coordinate - (1040, 714) - - - _rotation - 0 - - - gain - 1.0 - - - id - variable_low_pass_filter_taps_2 - - - samp_rate - final_rate - - - width - 500 - - - win - firdes.WIN_HAMMING - - - - analog_pwr_squelch_xx - - alpha - 0.1 - - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - _coordinate - (904, 471) - - - _rotation - 0 - - - gate - False - - - id - analog_pwr_squelch_xx_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - ramp - 0 - - - threshold - squelch_dB - - - type - complex - - - - analog_pwr_squelch_xx - - alpha - 0.1 - - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - _coordinate - (536, 615) - - - _rotation - 180 - - - gate - True - - - id - analog_pwr_squelch_xx_0_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - ramp - 0 - - - threshold - -200 - - - type - float - - - - analog_quadrature_demod_cf - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - _coordinate - (1072, 492) - - - _rotation - 0 - - - gain - 0.050 - - - id - analog_quadrature_demod_cf_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - - audio_sink - - alias - - - - comment - - - - affinity - - - - device_name - - - - _enabled - True - - - _coordinate - (536, 716) - - - _rotation - 180 - - - id - audio_sink_0 - - - num_inputs - 1 - - - ok_to_block - True - - - samp_rate - 16000 - - - - blocks_complex_to_mag_squared - - alias - - - - comment - Compute power - - - affinity - - - - _enabled - True - - - _coordinate - (888, 204) - - - _rotation - 0 - - - id - blocks_complex_to_mag_squared_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - vlen - fft_length - - - - blocks_integrate_xx - - alias - - - - comment - Video average down to 10 FFT/sec - - - affinity - - - - decim - 100 - - - _enabled - True - - - _coordinate - (1080, 197) - - - _rotation - 0 - - - id - blocks_integrate_xx_0 - - - type - float - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - vlen - fft_length - - - - blocks_keep_one_in_n - - alias - - - - comment - Want about 1000 FFT/sec -Keep 1 in 4 vectors - - - affinity - - - - _enabled - True - - - _coordinate - (472, 197) - - - _rotation - 0 - - - id - blocks_keep_one_in_n_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - n - int(round(samp_rate/fft_length/1000)) - - - type - complex - - - vlen - fft_length - - - - blocks_nlog10_ff - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - _coordinate - (1096, 54) - - - _rotation - 180 - - - id - blocks_nlog10_ff_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - vlen - fft_length - - - k - 0 - - - n - 10 - - - - blocks_probe_signal_vx - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - _coordinate - (896, 124) - - - _rotation - 180 - - - id - blocks_probe_signal_vx_0 - - - type - float - - - vlen - fft_length - - - - blocks_stream_to_vector - - alias - - - - comment - Example: -1024 length FFT -4 Msps / 1024 = 3906.25 Hz/bin -Also 3902.25 vec/sec - - - affinity - - - - _enabled - True - - - _coordinate - (256, 204) - - - _rotation - 0 - - - id - blocks_stream_to_vector_0 - - - type - complex - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - num_items - fft_length - - - vlen - 1 - - - - blocks_vector_to_stream - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - _coordinate - (928, 68) - - - _rotation - 180 - - - id - blocks_vector_to_stream_0 - - - type - float - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - num_items - fft_length - - - vlen - 1 - - - - blocks_wavfile_sink - - bits_per_sample - 8 - - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - file - file_name - - - _coordinate - (360, 622) - - - _rotation - 180 - - - id - blocks_wavfile_sink_0 - - - nchan - 1 - - - samp_rate - 16000 - - - - fft_vxx - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - fft_size - fft_length - - - forward - True - - - _coordinate - (656, 176) - - - _rotation - 0 - - - id - fft_vxx_0 - - - type - complex - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - nthreads - 1 - - - shift - True - - - window - window.blackmanharris(fft_length) - - - - fir_filter_xxx - - alias - - - - comment - samp_rate/5 to samp_rate/25 - - - affinity - - - - decim - initial_decim - - - _enabled - 1 - - - _coordinate - (488, 485) - - - _rotation - 0 - - - id - fir_filter_xxx_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samp_delay - 0 - - - taps - variable_low_pass_filter_taps_0 - - - type - ccc - - - - fir_filter_xxx - - alias - - - - comment - samp_rate/100 to 40-80 ksps - - - affinity - - - - decim - int(samp_rate/1E6) - - - _enabled - 1 - - - _coordinate - (688, 485) - - - _rotation - 0 - - - id - fir_filter_xxx_0_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samp_delay - 0 - - - taps - variable_low_pass_filter_taps_0 - - - type - ccc - - - - fir_filter_xxx - - alias - - - - comment - 40-80 ksps to 8-16 ksps - - - affinity - - - - decim - initial_decim - - - _enabled - 1 - - - _coordinate - (1048, 629) - - - _rotation - 180 - - - id - fir_filter_xxx_0_1 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samp_delay - 0 - - - taps - variable_low_pass_filter_taps_0 - - - type - fff - - - - freq_xlating_fir_filter_xxx - - alias - - - - center_freq - demod_bb_freq - - - comment - samp_rate to samp_rate/5 - - - affinity - - - - decim - initial_decim - - - _enabled - 1 - - - _coordinate - (248, 471) - - - _rotation - 0 - - - id - freq_xlating_fir_filter_xxx_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samp_rate - samp_rate - - - taps - variable_low_pass_filter_taps_0 - - - type - ccc - - - - import - - alias - - - - comment - - - - _enabled - True - - - _coordinate - (192, 12) - - - _rotation - 0 - - - id - import_0 - - - import - import numpy as np - - - - osmosdr_source - - alias - - - - ant0 - - - - bb_gain0 - 20 - - - bw0 - samp_rate*0.8 - - - dc_offset_mode0 - 0 - - - corr0 - 0 - - - freq0 - center_freq - - - gain_mode0 - False - - - if_gain0 - 20 - - - iq_balance_mode0 - 0 - - - gain0 - gain_db - - - ant10 - - - - bb_gain10 - 20 - - - bw10 - 0 - - - dc_offset_mode10 - 0 - - - corr10 - 0 - - - freq10 - 100e6 - - - gain_mode10 - False - - - if_gain10 - 20 - - - iq_balance_mode10 - 0 - - - gain10 - 10 - - - ant11 - - - - bb_gain11 - 20 - - - bw11 - 0 - - - dc_offset_mode11 - 0 - - - corr11 - 0 - - - freq11 - 100e6 - - - gain_mode11 - False - - - if_gain11 - 20 - - - iq_balance_mode11 - 0 - - - gain11 - 10 - - - ant12 - - - - bb_gain12 - 20 - - - bw12 - 0 - - - dc_offset_mode12 - 0 - - - corr12 - 0 - - - freq12 - 100e6 - - - gain_mode12 - False - - - if_gain12 - 20 - - - iq_balance_mode12 - 0 - - - gain12 - 10 - - - ant13 - - - - bb_gain13 - 20 - - - bw13 - 0 - - - dc_offset_mode13 - 0 - - - corr13 - 0 - - - freq13 - 100e6 - - - gain_mode13 - False - - - if_gain13 - 20 - - - iq_balance_mode13 - 0 - - - gain13 - 10 - - - ant14 - - - - bb_gain14 - 20 - - - bw14 - 0 - - - dc_offset_mode14 - 0 - - - corr14 - 0 - - - freq14 - 100e6 - - - gain_mode14 - False - - - if_gain14 - 20 - - - iq_balance_mode14 - 0 - - - gain14 - 10 - - - ant15 - - - - bb_gain15 - 20 - - - bw15 - 0 - - - dc_offset_mode15 - 0 - - - corr15 - 0 - - - freq15 - 100e6 - - - gain_mode15 - False - - - if_gain15 - 20 - - - iq_balance_mode15 - 0 - - - gain15 - 10 - - - ant16 - - - - bb_gain16 - 20 - - - bw16 - 0 - - - dc_offset_mode16 - 0 - - - corr16 - 0 - - - freq16 - 100e6 - - - gain_mode16 - False - - - if_gain16 - 20 - - - iq_balance_mode16 - 0 - - - gain16 - 10 - - - ant17 - - - - bb_gain17 - 20 - - - bw17 - 0 - - - dc_offset_mode17 - 0 - - - corr17 - 0 - - - freq17 - 100e6 - - - gain_mode17 - False - - - if_gain17 - 20 - - - iq_balance_mode17 - 0 - - - gain17 - 10 - - - ant18 - - - - bb_gain18 - 20 - - - bw18 - 0 - - - dc_offset_mode18 - 0 - - - corr18 - 0 - - - freq18 - 100e6 - - - gain_mode18 - False - - - if_gain18 - 20 - - - iq_balance_mode18 - 0 - - - gain18 - 10 - - - ant19 - - - - bb_gain19 - 20 - - - bw19 - 0 - - - dc_offset_mode19 - 0 - - - corr19 - 0 - - - freq19 - 100e6 - - - gain_mode19 - False - - - if_gain19 - 20 - - - iq_balance_mode19 - 0 - - - gain19 - 10 - - - ant1 - - - - bb_gain1 - 20 - - - bw1 - 0 - - - dc_offset_mode1 - 0 - - - corr1 - 0 - - - freq1 - 100e6 - - - gain_mode1 - False - - - if_gain1 - 20 - - - iq_balance_mode1 - 0 - - - gain1 - 10 - - - ant20 - - - - bb_gain20 - 20 - - - bw20 - 0 - - - dc_offset_mode20 - 0 - - - corr20 - 0 - - - freq20 - 100e6 - - - gain_mode20 - False - - - if_gain20 - 20 - - - iq_balance_mode20 - 0 - - - gain20 - 10 - - - ant21 - - - - bb_gain21 - 20 - - - bw21 - 0 - - - dc_offset_mode21 - 0 - - - corr21 - 0 - - - freq21 - 100e6 - - - gain_mode21 - False - - - if_gain21 - 20 - - - iq_balance_mode21 - 0 - - - gain21 - 10 - - - ant22 - - - - bb_gain22 - 20 - - - bw22 - 0 - - - dc_offset_mode22 - 0 - - - corr22 - 0 - - - freq22 - 100e6 - - - gain_mode22 - False - - - if_gain22 - 20 - - - iq_balance_mode22 - 0 - - - gain22 - 10 - - - ant23 - - - - bb_gain23 - 20 - - - bw23 - 0 - - - dc_offset_mode23 - 0 - - - corr23 - 0 - - - freq23 - 100e6 - - - gain_mode23 - False - - - if_gain23 - 20 - - - iq_balance_mode23 - 0 - - - gain23 - 10 - - - ant24 - - - - bb_gain24 - 20 - - - bw24 - 0 - - - dc_offset_mode24 - 0 - - - corr24 - 0 - - - freq24 - 100e6 - - - gain_mode24 - False - - - if_gain24 - 20 - - - iq_balance_mode24 - 0 - - - gain24 - 10 - - - ant25 - - - - bb_gain25 - 20 - - - bw25 - 0 - - - dc_offset_mode25 - 0 - - - corr25 - 0 - - - freq25 - 100e6 - - - gain_mode25 - False - - - if_gain25 - 20 - - - iq_balance_mode25 - 0 - - - gain25 - 10 - - - ant26 - - - - bb_gain26 - 20 - - - bw26 - 0 - - - dc_offset_mode26 - 0 - - - corr26 - 0 - - - freq26 - 100e6 - - - gain_mode26 - False - - - if_gain26 - 20 - - - iq_balance_mode26 - 0 - - - gain26 - 10 - - - ant27 - - - - bb_gain27 - 20 - - - bw27 - 0 - - - dc_offset_mode27 - 0 - - - corr27 - 0 - - - freq27 - 100e6 - - - gain_mode27 - False - - - if_gain27 - 20 - - - iq_balance_mode27 - 0 - - - gain27 - 10 - - - ant28 - - - - bb_gain28 - 20 - - - bw28 - 0 - - - dc_offset_mode28 - 0 - - - corr28 - 0 - - - freq28 - 100e6 - - - gain_mode28 - False - - - if_gain28 - 20 - - - iq_balance_mode28 - 0 - - - gain28 - 10 - - - ant29 - - - - bb_gain29 - 20 - - - bw29 - 0 - - - dc_offset_mode29 - 0 - - - corr29 - 0 - - - freq29 - 100e6 - - - gain_mode29 - False - - - if_gain29 - 20 - - - iq_balance_mode29 - 0 - - - gain29 - 10 - - - ant2 - - - - bb_gain2 - 20 - - - bw2 - 0 - - - dc_offset_mode2 - 0 - - - corr2 - 0 - - - freq2 - 100e6 - - - gain_mode2 - False - - - if_gain2 - 20 - - - iq_balance_mode2 - 0 - - - gain2 - 10 - - - ant30 - - - - bb_gain30 - 20 - - - bw30 - 0 - - - dc_offset_mode30 - 0 - - - corr30 - 0 - - - freq30 - 100e6 - - - gain_mode30 - False - - - if_gain30 - 20 - - - iq_balance_mode30 - 0 - - - gain30 - 10 - - - ant31 - - - - bb_gain31 - 20 - - - bw31 - 0 - - - dc_offset_mode31 - 0 - - - corr31 - 0 - - - freq31 - 100e6 - - - gain_mode31 - False - - - if_gain31 - 20 - - - iq_balance_mode31 - 0 - - - gain31 - 10 - - - ant3 - - - - bb_gain3 - 20 - - - bw3 - 0 - - - dc_offset_mode3 - 0 - - - corr3 - 0 - - - freq3 - 100e6 - - - gain_mode3 - False - - - if_gain3 - 20 - - - iq_balance_mode3 - 0 - - - gain3 - 10 - - - ant4 - - - - bb_gain4 - 20 - - - bw4 - 0 - - - dc_offset_mode4 - 0 - - - corr4 - 0 - - - freq4 - 100e6 - - - gain_mode4 - False - - - if_gain4 - 20 - - - iq_balance_mode4 - 0 - - - gain4 - 10 - - - ant5 - - - - bb_gain5 - 20 - - - bw5 - 0 - - - dc_offset_mode5 - 0 - - - corr5 - 0 - - - freq5 - 100e6 - - - gain_mode5 - False - - - if_gain5 - 20 - - - iq_balance_mode5 - 0 - - - gain5 - 10 - - - ant6 - - - - bb_gain6 - 20 - - - bw6 - 0 - - - dc_offset_mode6 - 0 - - - corr6 - 0 - - - freq6 - 100e6 - - - gain_mode6 - False - - - if_gain6 - 20 - - - iq_balance_mode6 - 0 - - - gain6 - 10 - - - ant7 - - - - bb_gain7 - 20 - - - bw7 - 0 - - - dc_offset_mode7 - 0 - - - corr7 - 0 - - - freq7 - 100e6 - - - gain_mode7 - False - - - if_gain7 - 20 - - - iq_balance_mode7 - 0 - - - gain7 - 10 - - - ant8 - - - - bb_gain8 - 20 - - - bw8 - 0 - - - dc_offset_mode8 - 0 - - - corr8 - 0 - - - freq8 - 100e6 - - - gain_mode8 - False - - - if_gain8 - 20 - - - iq_balance_mode8 - 0 - - - gain8 - 10 - - - ant9 - - - - bb_gain9 - 20 - - - bw9 - 0 - - - dc_offset_mode9 - 0 - - - corr9 - 0 - - - freq9 - 100e6 - - - gain_mode9 - False - - - if_gain9 - 20 - - - iq_balance_mode9 - 0 - - - gain9 - 10 - - - comment - - - - affinity - - - - args - uhd - - - _enabled - True - - - _coordinate - (8, 92) - - - _rotation - 0 - - - id - osmosdr_source_0 - - - maxoutbuf - 0 - - - clock_source0 - - - - time_source0 - - - - clock_source1 - - - - time_source1 - - - - clock_source2 - - - - time_source2 - - - - clock_source3 - - - - time_source3 - - - - clock_source4 - - - - time_source4 - - - - clock_source5 - - - - time_source5 - - - - clock_source6 - - - - time_source6 - - - - clock_source7 - - - - time_source7 - - - - minoutbuf - 0 - - - nchan - 1 - - - num_mboards - 1 - - - type - fc32 - - - sample_rate - samp_rate - - - sync - - - - - pfb_arb_resampler_xxx - - alias - - - - comment - Note this is set for 16 kHz (not 8 kHz) - - - affinity - - - - _enabled - True - - - _coordinate - (728, 615) - - - _rotation - 180 - - - id - pfb_arb_resampler_xxx_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - nfilts - 32 - - - rrate - 16E3/float(final_rate/5) - - - samp_delay - 0 - - - atten - 100 - - - taps - - - - type - fff - - - - qtgui_freq_sink_x - - autoscale - False - - - average - 1.0 - - - bw - samp_rate - - - alias - - - - fc - 144E6 - - - comment - - - - ctrlpanel - False - - - affinity - - - - _enabled - True - - - fftsize - fft_length - - - _coordinate - (272, 111) - - - gui_hint - 0,0,3,1 - - - _rotation - 0 - - - grid - False - - - id - qtgui_freq_sink_x_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 - "Spectrum" - - - nconnections - 1 - - - showports - True - - - freqhalf - True - - - tr_chan - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_tag - "" - - - type - complex - - - update_time - 0.10 - - - wintype - firdes.WIN_BLACKMAN_hARRIS - - - ymax - -20 - - - ymin - -120 - - - - qtgui_freq_sink_x - - autoscale - False - - - average - 1.0 - - - bw - final_rate - - - alias - - - - fc - 0 - - - comment - - - - ctrlpanel - False - - - affinity - - - - _enabled - True - - - fftsize - 1024 - - - _coordinate - (1016, 375) - - - gui_hint - 3,0,3,1 - - - _rotation - 0 - - - grid - False - - - 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 - "Decimated Channel" - - - nconnections - 1 - - - showports - True - - - freqhalf - True - - - tr_chan - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_tag - "" - - - type - complex - - - update_time - 0.10 - - - wintype - firdes.WIN_BLACKMAN_hARRIS - - - ymax - -60 - - - ymin - -200 - - - - qtgui_time_sink_x - - autoscale - False - - - alias - - - - comment - - - - ctrlpanel - False - - - affinity - - - - entags - True - - - _enabled - True - - - _coordinate - (704, 47) - - - gui_hint - 0,1,3,1 - - - _rotation - 180 - - - grid - False - - - id - qtgui_time_sink_x_0 - - - legend - True - - - alpha1 - 1.0 - - - color1 - "blue" - - - label1 - - - - marker1 - -1 - - - style1 - 1 - - - width1 - 1 - - - alpha10 - 1.0 - - - color10 - "blue" - - - label10 - - - - marker10 - -1 - - - style10 - 1 - - - width10 - 1 - - - alpha2 - 1.0 - - - color2 - "red" - - - label2 - - - - marker2 - -1 - - - style2 - 1 - - - width2 - 1 - - - alpha3 - 1.0 - - - color3 - "green" - - - label3 - - - - marker3 - -1 - - - style3 - 1 - - - width3 - 1 - - - alpha4 - 1.0 - - - color4 - "black" - - - label4 - - - - marker4 - -1 - - - style4 - 1 - - - width4 - 1 - - - alpha5 - 1.0 - - - color5 - "cyan" - - - label5 - - - - marker5 - -1 - - - style5 - 1 - - - width5 - 1 - - - alpha6 - 1.0 - - - color6 - "magenta" - - - label6 - - - - marker6 - -1 - - - style6 - 1 - - - width6 - 1 - - - alpha7 - 1.0 - - - color7 - "yellow" - - - label7 - - - - marker7 - -1 - - - style7 - 1 - - - width7 - 1 - - - alpha8 - 1.0 - - - color8 - "dark red" - - - label8 - - - - marker8 - -1 - - - style8 - 1 - - - width8 - 1 - - - alpha9 - 1.0 - - - color9 - "dark green" - - - label9 - - - - marker9 - -1 - - - style9 - 1 - - - width9 - 1 - - - name - "Averaged Spectrum" - - - nconnections - 1 - - - size - fft_length - - - srate - samp_rate - - - tr_chan - 0 - - - tr_delay - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_slope - qtgui.TRIG_SLOPE_POS - - - tr_tag - "" - - - type - float - - - update_time - 0.10 - - - ylabel - Power - - - yunit - "" - - - ymax - 40 - - - ymin - -60 - - - - analog_pwr_squelch_xx_0 - analog_quadrature_demod_cf_0 - 0 - 0 - - - analog_pwr_squelch_xx_0_0 - blocks_wavfile_sink_0 - 0 - 0 - - - analog_quadrature_demod_cf_0 - fir_filter_xxx_0_1 - 0 - 0 - - - blocks_complex_to_mag_squared_0 - blocks_integrate_xx_0 - 0 - 0 - - - blocks_integrate_xx_0 - blocks_nlog10_ff_0 - 0 - 0 - - - blocks_keep_one_in_n_0 - fft_vxx_0 - 0 - 0 - - - blocks_nlog10_ff_0 - blocks_probe_signal_vx_0 - 0 - 0 - - - blocks_nlog10_ff_0 - blocks_vector_to_stream_0 - 0 - 0 - - - blocks_stream_to_vector_0 - blocks_keep_one_in_n_0 - 0 - 0 - - - blocks_vector_to_stream_0 - qtgui_time_sink_x_0 - 0 - 0 - - - fft_vxx_0 - blocks_complex_to_mag_squared_0 - 0 - 0 - - - fir_filter_xxx_0 - fir_filter_xxx_0_0 - 0 - 0 - - - fir_filter_xxx_0_0 - analog_pwr_squelch_xx_0 - 0 - 0 - - - fir_filter_xxx_0_0 - qtgui_freq_sink_x_0_0 - 0 - 0 - - - fir_filter_xxx_0_1 - pfb_arb_resampler_xxx_0 - 0 - 0 - - - freq_xlating_fir_filter_xxx_0 - fir_filter_xxx_0 - 0 - 0 - - - osmosdr_source_0 - blocks_stream_to_vector_0 - 0 - 0 - - - osmosdr_source_0 - freq_xlating_fir_filter_xxx_0 - 0 - 0 - - - osmosdr_source_0 - qtgui_freq_sink_x_0 - 0 - 0 - - - pfb_arb_resampler_xxx_0 - analog_pwr_squelch_xx_0_0 - 0 - 0 - - - pfb_arb_resampler_xxx_0 - audio_sink_0 - 0 - 0 - - +options: + parameters: + author: '' + catch_exceptions: 'True' + category: Custom + cmake_opt: '' + comment: '' + copyright: '' + description: Example of GR DSP flow in receiver.py + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: nbfm_flow_example + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: Ham2Mon NBFM Receiver Flow Example + window_size: 1280, 1024 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 7] + rotation: 0 + state: enabled + +blocks: +- name: center_freq + id: variable + parameters: + comment: '' + value: 144E6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [16, 285] + rotation: 0 + state: enabled +- name: demod_bb_freq + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 3,1,1,3 + label: '"Demod BB Freq (Hz)"' + min_len: '200' + orient: QtCore.Qt.Horizontal + outputmsgname: value + rangeType: float + showports: 'False' + start: -samp_rate/2 + step: 5E3 + stop: samp_rate/2 + value: 390E3 + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [24, 385] + rotation: 0 + state: enabled +- name: fft_length + id: variable + parameters: + comment: '' + value: 256 * int(pow(2, np.ceil(np.log(samp_ratio)/np.log(2)))) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [464, 13] + rotation: 0 + state: enabled +- name: file_name + id: variable + parameters: + comment: '' + value: '"test.wav"' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [120, 628.0] + rotation: 0 + state: enabled +- name: final_decim + id: variable + parameters: + comment: '' + value: int(samp_rate/1E6) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [832, 333] + rotation: 0 + state: enabled +- name: final_rate + id: variable + parameters: + comment: '' + value: samp_rate/initial_decim**2/int(samp_rate/1E6) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [832, 397] + rotation: 0 + state: enabled +- name: gain_db + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 4,1,1,3 + label: '"HW Gain (dB)"' + min_len: '200' + orient: QtCore.Qt.Horizontal + outputmsgname: value + rangeType: float + showports: 'False' + start: '0' + step: '1' + stop: '70' + value: '30' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [568, 9] + rotation: 0 + state: enabled +- name: initial_decim + id: variable + parameters: + comment: '' + value: '5' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [432, 405] + rotation: 0 + state: enabled +- name: samp_rate + id: variable + parameters: + comment: 1E6 minimum + value: 1E6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [272, 13] + rotation: 0 + state: enabled +- name: samp_ratio + id: variable + parameters: + comment: '' + value: samp_rate/1E6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [368, 13] + rotation: 0 + state: enabled +- name: squelch_dB + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 5,1,1,3 + label: '"Squelch (dB)"' + min_len: '200' + orient: QtCore.Qt.Horizontal + outputmsgname: value + rangeType: float + showports: 'False' + start: '-100' + step: '5' + stop: '0' + value: '-70' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [752, 721] + rotation: 0 + state: enabled +- name: variable_low_pass_filter_taps_0 + id: variable_low_pass_filter_taps + parameters: + beta: '6.76' + comment: '' + cutoff_freq: '0.090' + gain: '1.0' + samp_rate: '1' + value: '' + width: '0.010' + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [248, 338] + rotation: 0 + state: enabled +- name: variable_low_pass_filter_taps_1 + id: variable_low_pass_filter_taps + parameters: + beta: '6.76' + comment: '' + cutoff_freq: 12.5E3 + gain: '1.0' + samp_rate: samp_rate/25 + value: '' + width: 1E3 + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [664, 330] + rotation: 0 + state: enabled +- name: variable_low_pass_filter_taps_2 + id: variable_low_pass_filter_taps + parameters: + beta: '6.76' + comment: '' + cutoff_freq: '3500' + gain: '1.0' + samp_rate: final_rate + value: '' + width: '500' + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1040, 714] + rotation: 0 + state: enabled +- name: analog_pwr_squelch_xx_0 + id: analog_pwr_squelch_xx + parameters: + affinity: '' + alias: '' + alpha: '0.1' + comment: '' + gate: 'False' + maxoutbuf: '0' + minoutbuf: '0' + ramp: '0' + threshold: squelch_dB + type: complex + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [904, 471] + rotation: 0 + state: enabled +- name: analog_pwr_squelch_xx_0_0 + id: analog_pwr_squelch_xx + parameters: + affinity: '' + alias: '' + alpha: '0.1' + comment: '' + gate: 'True' + maxoutbuf: '0' + minoutbuf: '0' + ramp: '0' + threshold: '-200' + type: float + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [536, 615] + rotation: 180 + state: enabled +- name: analog_quadrature_demod_cf_0 + id: analog_quadrature_demod_cf + parameters: + affinity: '' + alias: '' + comment: '' + gain: '0.050' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1072, 492] + rotation: 0 + state: enabled +- name: audio_sink_0 + id: audio_sink + parameters: + affinity: '' + alias: '' + comment: '' + device_name: '' + num_inputs: '1' + ok_to_block: 'True' + samp_rate: '16000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [536, 716] + rotation: 180 + state: enabled +- name: blocks_complex_to_mag_squared_0 + id: blocks_complex_to_mag_squared + parameters: + affinity: '' + alias: '' + comment: Compute power + maxoutbuf: '0' + minoutbuf: '0' + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [888, 204] + rotation: 0 + state: enabled +- name: blocks_integrate_xx_0 + id: blocks_integrate_xx + parameters: + affinity: '' + alias: '' + comment: Video average down to 10 FFT/sec + decim: '100' + maxoutbuf: '0' + minoutbuf: '0' + type: float + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1080, 197] + rotation: 0 + state: enabled +- name: blocks_keep_one_in_n_0 + id: blocks_keep_one_in_n + parameters: + affinity: '' + alias: '' + comment: 'Want about 1000 FFT/sec + + Keep 1 in 4 vectors' + maxoutbuf: '0' + minoutbuf: '0' + n: int(round(samp_rate/fft_length/1000)) + type: complex + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [472, 197] + rotation: 0 + state: enabled +- name: blocks_nlog10_ff_0 + id: blocks_nlog10_ff + parameters: + affinity: '' + alias: '' + comment: '' + k: '0' + maxoutbuf: '0' + minoutbuf: '0' + n: '10' + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1096, 54] + rotation: 180 + state: enabled +- name: blocks_probe_signal_vx_0 + id: blocks_probe_signal_vx + parameters: + affinity: '' + alias: '' + comment: '' + type: float + vlen: fft_length + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [896, 124] + rotation: 180 + state: enabled +- name: blocks_stream_to_vector_0 + id: blocks_stream_to_vector + parameters: + affinity: '' + alias: '' + comment: 'Example: + + 1024 length FFT + + 4 Msps / 1024 = 3906.25 Hz/bin + + Also 3902.25 vec/sec' + maxoutbuf: '0' + minoutbuf: '0' + num_items: fft_length + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [256, 204] + rotation: 0 + state: enabled +- name: blocks_vector_to_stream_0 + id: blocks_vector_to_stream + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_items: fft_length + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [928, 68] + rotation: 180 + state: enabled +- name: blocks_wavfile_sink_0 + id: blocks_wavfile_sink + parameters: + affinity: '' + alias: '' + append: 'False' + bits_per_sample1: FORMAT_PCM_U8 + bits_per_sample2: FORMAT_PCM_16 + bits_per_sample3: FORMAT_VORBIS + bits_per_sample4: FORMAT_PCM_16 + comment: '' + file: file_name + format: FORMAT_WAV + nchan: '1' + samp_rate: '16000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [360, 622] + rotation: 180 + state: enabled +- name: fft_vxx_0 + id: fft_vxx + parameters: + affinity: '' + alias: '' + comment: '' + fft_size: fft_length + forward: 'True' + maxoutbuf: '0' + minoutbuf: '0' + nthreads: '1' + shift: 'True' + type: complex + window: window.blackmanharris(fft_length) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [656, 176] + rotation: 0 + state: enabled +- name: fir_filter_xxx_0 + id: fir_filter_xxx + parameters: + affinity: '' + alias: '' + comment: samp_rate/5 to samp_rate/25 + decim: initial_decim + maxoutbuf: '0' + minoutbuf: '0' + samp_delay: '0' + taps: variable_low_pass_filter_taps_0 + type: ccc + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [488, 485] + rotation: 0 + state: enabled +- name: fir_filter_xxx_0_0 + id: fir_filter_xxx + parameters: + affinity: '' + alias: '' + comment: samp_rate/100 to 40-80 ksps + decim: int(samp_rate/1E6) + maxoutbuf: '0' + minoutbuf: '0' + samp_delay: '0' + taps: variable_low_pass_filter_taps_0 + type: ccc + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [688, 485] + rotation: 0 + state: enabled +- name: fir_filter_xxx_0_1 + id: fir_filter_xxx + parameters: + affinity: '' + alias: '' + comment: 40-80 ksps to 8-16 ksps + decim: initial_decim + maxoutbuf: '0' + minoutbuf: '0' + samp_delay: '0' + taps: variable_low_pass_filter_taps_0 + type: fff + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1048, 629] + rotation: 180 + state: enabled +- name: freq_xlating_fir_filter_xxx_0 + id: freq_xlating_fir_filter_xxx + parameters: + affinity: '' + alias: '' + center_freq: demod_bb_freq + comment: samp_rate to samp_rate/5 + decim: initial_decim + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: samp_rate + taps: variable_low_pass_filter_taps_0 + type: ccc + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [248, 471] + rotation: 0 + state: enabled +- name: import_0 + id: import + parameters: + alias: '' + comment: '' + imports: import numpy as np + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [192, 12] + rotation: 0 + state: enabled +- name: osmosdr_source_0 + id: osmosdr_source + parameters: + affinity: '' + alias: '' + ant0: '' + ant1: '' + ant10: '' + ant11: '' + ant12: '' + ant13: '' + ant14: '' + ant15: '' + ant16: '' + ant17: '' + ant18: '' + ant19: '' + ant2: '' + ant20: '' + ant21: '' + ant22: '' + ant23: '' + ant24: '' + ant25: '' + ant26: '' + ant27: '' + ant28: '' + ant29: '' + ant3: '' + ant30: '' + ant31: '' + ant4: '' + ant5: '' + ant6: '' + ant7: '' + ant8: '' + ant9: '' + args: uhd + bb_gain0: '20' + bb_gain1: '20' + bb_gain10: '20' + bb_gain11: '20' + bb_gain12: '20' + bb_gain13: '20' + bb_gain14: '20' + bb_gain15: '20' + bb_gain16: '20' + bb_gain17: '20' + bb_gain18: '20' + bb_gain19: '20' + bb_gain2: '20' + bb_gain20: '20' + bb_gain21: '20' + bb_gain22: '20' + bb_gain23: '20' + bb_gain24: '20' + bb_gain25: '20' + bb_gain26: '20' + bb_gain27: '20' + bb_gain28: '20' + bb_gain29: '20' + bb_gain3: '20' + bb_gain30: '20' + bb_gain31: '20' + bb_gain4: '20' + bb_gain5: '20' + bb_gain6: '20' + bb_gain7: '20' + bb_gain8: '20' + bb_gain9: '20' + bw0: samp_rate*0.8 + bw1: '0' + bw10: '0' + bw11: '0' + bw12: '0' + bw13: '0' + bw14: '0' + bw15: '0' + bw16: '0' + bw17: '0' + bw18: '0' + bw19: '0' + bw2: '0' + bw20: '0' + bw21: '0' + bw22: '0' + bw23: '0' + bw24: '0' + bw25: '0' + bw26: '0' + bw27: '0' + bw28: '0' + bw29: '0' + bw3: '0' + bw30: '0' + bw31: '0' + bw4: '0' + bw5: '0' + bw6: '0' + bw7: '0' + bw8: '0' + bw9: '0' + clock_source0: '' + clock_source1: '' + clock_source2: '' + clock_source3: '' + clock_source4: '' + clock_source5: '' + clock_source6: '' + clock_source7: '' + comment: '' + corr0: '0' + corr1: '0' + corr10: '0' + corr11: '0' + corr12: '0' + corr13: '0' + corr14: '0' + corr15: '0' + corr16: '0' + corr17: '0' + corr18: '0' + corr19: '0' + corr2: '0' + corr20: '0' + corr21: '0' + corr22: '0' + corr23: '0' + corr24: '0' + corr25: '0' + corr26: '0' + corr27: '0' + corr28: '0' + corr29: '0' + corr3: '0' + corr30: '0' + corr31: '0' + corr4: '0' + corr5: '0' + corr6: '0' + corr7: '0' + corr8: '0' + corr9: '0' + dc_offset_mode0: '0' + dc_offset_mode1: '0' + dc_offset_mode10: '0' + dc_offset_mode11: '0' + dc_offset_mode12: '0' + dc_offset_mode13: '0' + dc_offset_mode14: '0' + dc_offset_mode15: '0' + dc_offset_mode16: '0' + dc_offset_mode17: '0' + dc_offset_mode18: '0' + dc_offset_mode19: '0' + dc_offset_mode2: '0' + dc_offset_mode20: '0' + dc_offset_mode21: '0' + dc_offset_mode22: '0' + dc_offset_mode23: '0' + dc_offset_mode24: '0' + dc_offset_mode25: '0' + dc_offset_mode26: '0' + dc_offset_mode27: '0' + dc_offset_mode28: '0' + dc_offset_mode29: '0' + dc_offset_mode3: '0' + dc_offset_mode30: '0' + dc_offset_mode31: '0' + dc_offset_mode4: '0' + dc_offset_mode5: '0' + dc_offset_mode6: '0' + dc_offset_mode7: '0' + dc_offset_mode8: '0' + dc_offset_mode9: '0' + freq0: center_freq + freq1: 100e6 + freq10: 100e6 + freq11: 100e6 + freq12: 100e6 + freq13: 100e6 + freq14: 100e6 + freq15: 100e6 + freq16: 100e6 + freq17: 100e6 + freq18: 100e6 + freq19: 100e6 + freq2: 100e6 + freq20: 100e6 + freq21: 100e6 + freq22: 100e6 + freq23: 100e6 + freq24: 100e6 + freq25: 100e6 + freq26: 100e6 + freq27: 100e6 + freq28: 100e6 + freq29: 100e6 + freq3: 100e6 + freq30: 100e6 + freq31: 100e6 + freq4: 100e6 + freq5: 100e6 + freq6: 100e6 + freq7: 100e6 + freq8: 100e6 + freq9: 100e6 + gain0: gain_db + gain1: '10' + gain10: '10' + gain11: '10' + gain12: '10' + gain13: '10' + gain14: '10' + gain15: '10' + gain16: '10' + gain17: '10' + gain18: '10' + gain19: '10' + gain2: '10' + gain20: '10' + gain21: '10' + gain22: '10' + gain23: '10' + gain24: '10' + gain25: '10' + gain26: '10' + gain27: '10' + gain28: '10' + gain29: '10' + gain3: '10' + gain30: '10' + gain31: '10' + gain4: '10' + gain5: '10' + gain6: '10' + gain7: '10' + gain8: '10' + gain9: '10' + gain_mode0: 'False' + gain_mode1: 'False' + gain_mode10: 'False' + gain_mode11: 'False' + gain_mode12: 'False' + gain_mode13: 'False' + gain_mode14: 'False' + gain_mode15: 'False' + gain_mode16: 'False' + gain_mode17: 'False' + gain_mode18: 'False' + gain_mode19: 'False' + gain_mode2: 'False' + gain_mode20: 'False' + gain_mode21: 'False' + gain_mode22: 'False' + gain_mode23: 'False' + gain_mode24: 'False' + gain_mode25: 'False' + gain_mode26: 'False' + gain_mode27: 'False' + gain_mode28: 'False' + gain_mode29: 'False' + gain_mode3: 'False' + gain_mode30: 'False' + gain_mode31: 'False' + gain_mode4: 'False' + gain_mode5: 'False' + gain_mode6: 'False' + gain_mode7: 'False' + gain_mode8: 'False' + gain_mode9: 'False' + if_gain0: '20' + if_gain1: '20' + if_gain10: '20' + if_gain11: '20' + if_gain12: '20' + if_gain13: '20' + if_gain14: '20' + if_gain15: '20' + if_gain16: '20' + if_gain17: '20' + if_gain18: '20' + if_gain19: '20' + if_gain2: '20' + if_gain20: '20' + if_gain21: '20' + if_gain22: '20' + if_gain23: '20' + if_gain24: '20' + if_gain25: '20' + if_gain26: '20' + if_gain27: '20' + if_gain28: '20' + if_gain29: '20' + if_gain3: '20' + if_gain30: '20' + if_gain31: '20' + if_gain4: '20' + if_gain5: '20' + if_gain6: '20' + if_gain7: '20' + if_gain8: '20' + if_gain9: '20' + iq_balance_mode0: '0' + iq_balance_mode1: '0' + iq_balance_mode10: '0' + iq_balance_mode11: '0' + iq_balance_mode12: '0' + iq_balance_mode13: '0' + iq_balance_mode14: '0' + iq_balance_mode15: '0' + iq_balance_mode16: '0' + iq_balance_mode17: '0' + iq_balance_mode18: '0' + iq_balance_mode19: '0' + iq_balance_mode2: '0' + iq_balance_mode20: '0' + iq_balance_mode21: '0' + iq_balance_mode22: '0' + iq_balance_mode23: '0' + iq_balance_mode24: '0' + iq_balance_mode25: '0' + iq_balance_mode26: '0' + iq_balance_mode27: '0' + iq_balance_mode28: '0' + iq_balance_mode29: '0' + iq_balance_mode3: '0' + iq_balance_mode30: '0' + iq_balance_mode31: '0' + iq_balance_mode4: '0' + iq_balance_mode5: '0' + iq_balance_mode6: '0' + iq_balance_mode7: '0' + iq_balance_mode8: '0' + iq_balance_mode9: '0' + maxoutbuf: '0' + minoutbuf: '0' + nchan: '1' + num_mboards: '1' + sample_rate: samp_rate + sync: sync + time_source0: '' + time_source1: '' + time_source2: '' + time_source3: '' + time_source4: '' + time_source5: '' + time_source6: '' + time_source7: '' + type: fc32 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 92] + rotation: 0 + state: enabled +- name: pfb_arb_resampler_xxx_0 + id: pfb_arb_resampler_xxx + parameters: + affinity: '' + alias: '' + atten: '100' + comment: Note this is set for 16 kHz (not 8 kHz) + maxoutbuf: '0' + minoutbuf: '0' + nfilts: '32' + rrate: 16E3/float(final_rate/5) + samp_delay: '0' + taps: '' + type: fff + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [728, 615] + rotation: 180 + state: enabled +- name: qtgui_freq_sink_x_0 + id: qtgui_freq_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + average: '1.0' + axislabels: 'True' + bw: samp_rate + color1: '"blue"' + color10: '"dark blue"' + color2: '"red"' + color3: '"green"' + color4: '"black"' + color5: '"cyan"' + color6: '"magenta"' + color7: '"yellow"' + color8: '"dark red"' + color9: '"dark green"' + comment: '' + ctrlpanel: 'False' + fc: 144E6 + fftsize: fft_length + freqhalf: 'True' + grid: 'False' + gui_hint: 0,0,3,1 + label: Relative Gain + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '"Spectrum"' + nconnections: '1' + norm_window: 'False' + showports: 'True' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_tag: '""' + type: complex + units: dB + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + wintype: window.WIN_BLACKMAN_hARRIS + ymax: '-20' + ymin: '-120' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [272, 111] + rotation: 0 + state: enabled +- name: qtgui_freq_sink_x_0_0 + id: qtgui_freq_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + average: '1.0' + axislabels: 'True' + bw: final_rate + color1: '"blue"' + color10: '"dark blue"' + color2: '"red"' + color3: '"green"' + color4: '"black"' + color5: '"cyan"' + color6: '"magenta"' + color7: '"yellow"' + color8: '"dark red"' + color9: '"dark green"' + comment: '' + ctrlpanel: 'False' + fc: '0' + fftsize: '1024' + freqhalf: 'True' + grid: 'False' + gui_hint: 3,0,3,1 + label: Relative Gain + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '"Decimated Channel"' + nconnections: '1' + norm_window: 'False' + showports: 'True' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_tag: '""' + type: complex + units: dB + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + wintype: window.WIN_BLACKMAN_hARRIS + ymax: '-60' + ymin: '-200' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1016, 375] + rotation: 0 + state: enabled +- name: qtgui_time_sink_x_0 + id: qtgui_time_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 0,1,3,1 + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '"Averaged Spectrum"' + nconnections: '1' + size: fft_length + srate: samp_rate + stemplot: 'False' + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: float + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Power + ymax: '40' + ymin: '-60' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [704, 47] + rotation: 180 + state: enabled + +connections: +- [analog_pwr_squelch_xx_0, '0', analog_quadrature_demod_cf_0, '0'] +- [analog_pwr_squelch_xx_0_0, '0', blocks_wavfile_sink_0, '0'] +- [analog_quadrature_demod_cf_0, '0', fir_filter_xxx_0_1, '0'] +- [blocks_complex_to_mag_squared_0, '0', blocks_integrate_xx_0, '0'] +- [blocks_integrate_xx_0, '0', blocks_nlog10_ff_0, '0'] +- [blocks_keep_one_in_n_0, '0', fft_vxx_0, '0'] +- [blocks_nlog10_ff_0, '0', blocks_probe_signal_vx_0, '0'] +- [blocks_nlog10_ff_0, '0', blocks_vector_to_stream_0, '0'] +- [blocks_stream_to_vector_0, '0', blocks_keep_one_in_n_0, '0'] +- [blocks_vector_to_stream_0, '0', qtgui_time_sink_x_0, '0'] +- [fft_vxx_0, '0', blocks_complex_to_mag_squared_0, '0'] +- [fir_filter_xxx_0, '0', fir_filter_xxx_0_0, '0'] +- [fir_filter_xxx_0_0, '0', analog_pwr_squelch_xx_0, '0'] +- [fir_filter_xxx_0_0, '0', qtgui_freq_sink_x_0_0, '0'] +- [fir_filter_xxx_0_1, '0', pfb_arb_resampler_xxx_0, '0'] +- [freq_xlating_fir_filter_xxx_0, '0', fir_filter_xxx_0, '0'] +- [osmosdr_source_0, '0', blocks_stream_to_vector_0, '0'] +- [osmosdr_source_0, '0', freq_xlating_fir_filter_xxx_0, '0'] +- [osmosdr_source_0, '0', qtgui_freq_sink_x_0, '0'] +- [pfb_arb_resampler_xxx_0, '0', analog_pwr_squelch_xx_0_0, '0'] +- [pfb_arb_resampler_xxx_0, '0', audio_sink_0, '0'] + +metadata: + file_format: 1 + grc_version: v3.11.0.0git-215-g9a698313 diff --git a/apps/nbfm_flow_example.py b/apps/nbfm_flow_example.py index 085c36e..a2b9dcb 100755 --- a/apps/nbfm_flow_example.py +++ b/apps/nbfm_flow_example.py @@ -1,10 +1,15 @@ -#!/usr/bin/env python2 -################################################## +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# +# SPDX-License-Identifier: GPL-3.0 +# # GNU Radio Python Flow Graph # Title: Ham2Mon NBFM Receiver Flow Example # Description: Example of GR DSP flow in receiver.py -# Generated: Sun Aug 16 20:37:05 2015 -################################################## +# GNU Radio version: v3.11.0.0git-215-g9a698313 + +from packaging.version import Version as StrictVersion if __name__ == '__main__': import ctypes @@ -14,41 +19,47 @@ x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: - print "Warning: failed to XInitThreads()" + print("Warning: failed to XInitThreads()") -from PyQt4 import Qt +from PyQt5 import Qt +from gnuradio import qtgui +from gnuradio.filter import firdes +import sip from gnuradio import analog +import math from gnuradio import audio from gnuradio import blocks -from gnuradio import eng_notation from gnuradio import fft +from gnuradio.fft import window from gnuradio import filter from gnuradio import gr -from gnuradio import qtgui -from gnuradio.eng_option import eng_option -from gnuradio.fft import window -from gnuradio.filter import firdes +import sys +import signal +from argparse import ArgumentParser +from gnuradio.eng_arg import eng_float, intx +from gnuradio import eng_notation from gnuradio.filter import pfb -from gnuradio.qtgui import Range, RangeWidget -from optparse import OptionParser -import math +from gnuradio.qtgui import Range, GrRangeWidget +from PyQt5 import QtCore import numpy as np import osmosdr -import sip -import sys import time + +from gnuradio import qtgui + class nbfm_flow_example(gr.top_block, Qt.QWidget): def __init__(self): - gr.top_block.__init__(self, "Ham2Mon NBFM Receiver Flow Example") + gr.top_block.__init__(self, "Ham2Mon NBFM Receiver Flow Example", catch_exceptions=True) Qt.QWidget.__init__(self) self.setWindowTitle("Ham2Mon NBFM Receiver Flow Example") + qtgui.util.check_set_qss() try: - self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) + self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: - pass + pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() @@ -62,7 +73,14 @@ def __init__(self): self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "nbfm_flow_example") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) + + try: + if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + self.restoreGeometry(self.settings.value("geometry").toByteArray()) + else: + self.restoreGeometry(self.settings.value("geometry")) + except: + pass ################################################## # Variables @@ -71,15 +89,9 @@ def __init__(self): self.initial_decim = initial_decim = 5 self.samp_ratio = samp_ratio = samp_rate/1E6 self.final_rate = final_rate = samp_rate/initial_decim**2/int(samp_rate/1E6) - - self.variable_low_pass_filter_taps_2 = variable_low_pass_filter_taps_2 = firdes.low_pass(1.0, final_rate, 3500, 500, firdes.WIN_HAMMING, 6.76) - - - self.variable_low_pass_filter_taps_1 = variable_low_pass_filter_taps_1 = firdes.low_pass(1.0, samp_rate/25, 12.5E3, 1E3, firdes.WIN_HAMMING, 6.76) - - - self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass(1.0, 1, 0.090, 0.010, firdes.WIN_HAMMING, 6.76) - + self.variable_low_pass_filter_taps_2 = variable_low_pass_filter_taps_2 = firdes.low_pass(1.0, final_rate, 3500,500, window.WIN_HAMMING, 6.76) + self.variable_low_pass_filter_taps_1 = variable_low_pass_filter_taps_1 = firdes.low_pass(1.0, samp_rate/25, 12.5E3,1E3, window.WIN_HAMMING, 6.76) + self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 = firdes.low_pass(1.0, 1, 0.090,0.010, window.WIN_HAMMING, 6.76) self.squelch_dB = squelch_dB = -70 self.gain_db = gain_db = 30 self.final_decim = final_decim = int(samp_rate/1E6) @@ -92,48 +104,68 @@ def __init__(self): # Blocks ################################################## self._squelch_dB_range = Range(-100, 0, 5, -70, 200) - self._squelch_dB_win = RangeWidget(self._squelch_dB_range, self.set_squelch_dB, "Squelch (dB)", "counter_slider", float) - self.top_grid_layout.addWidget(self._squelch_dB_win, 5,1,1,3) + self._squelch_dB_win = GrRangeWidget(self._squelch_dB_range, self.set_squelch_dB, "Squelch (dB)", "counter_slider", float, QtCore.Qt.Horizontal, "value") + self.squelch_dB = self._squelch_dB_win + + self.top_grid_layout.addWidget(self._squelch_dB_win, 5, 1, 1, 3) + for r in range(5, 6): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(1, 4): + self.top_grid_layout.setColumnStretch(c, 1) self._gain_db_range = Range(0, 70, 1, 30, 200) - self._gain_db_win = RangeWidget(self._gain_db_range, self.set_gain_db, "HW Gain (dB)", "counter_slider", float) - self.top_grid_layout.addWidget(self._gain_db_win, 4,1,1,3) + self._gain_db_win = GrRangeWidget(self._gain_db_range, self.set_gain_db, "HW Gain (dB)", "counter_slider", float, QtCore.Qt.Horizontal, "value") + self.gain_db = self._gain_db_win + + self.top_grid_layout.addWidget(self._gain_db_win, 4, 1, 1, 3) + for r in range(4, 5): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(1, 4): + self.top_grid_layout.setColumnStretch(c, 1) self._demod_bb_freq_range = Range(-samp_rate/2, samp_rate/2, 5E3, 390E3, 200) - self._demod_bb_freq_win = RangeWidget(self._demod_bb_freq_range, self.set_demod_bb_freq, "Demod BB Freq (Hz)", "counter_slider", float) - self.top_grid_layout.addWidget(self._demod_bb_freq_win, 3,1,1,3) + self._demod_bb_freq_win = GrRangeWidget(self._demod_bb_freq_range, self.set_demod_bb_freq, "Demod BB Freq (Hz)", "counter_slider", float, QtCore.Qt.Horizontal, "value") + self.demod_bb_freq = self._demod_bb_freq_win + + self.top_grid_layout.addWidget(self._demod_bb_freq_win, 3, 1, 1, 3) + for r in range(3, 4): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(1, 4): + self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( - fft_length, #size - samp_rate, #samp_rate - "Averaged Spectrum", #name - 1 #number of inputs + fft_length, #size + samp_rate, #samp_rate + "Averaged Spectrum", #name + 1, #number of inputs + None # parent ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-60, 40) - - self.qtgui_time_sink_x_0.set_y_label("Power", "") - - self.qtgui_time_sink_x_0.enable_tags(-1, True) + + self.qtgui_time_sink_x_0.set_y_label('Power', "") + + self.qtgui_time_sink_x_0.enable_tags(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) + self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) - - if not True: - self.qtgui_time_sink_x_0.disable_legend() - - labels = ["", "", "", "", "", - "", "", "", "", ""] + self.qtgui_time_sink_x_0.enable_stem_plot(False) + + + labels = ['', '', '', '', '', + '', '', '', '', ''] widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "blue"] + 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] styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] + 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - 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(1): + -1, -1, -1, -1, -1] + + + for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: @@ -143,40 +175,45 @@ def __init__(self): self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0,1,3,1) + + self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.qwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0, 1, 3, 1) + for r in range(0, 3): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(1, 2): + self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - final_rate, #bw - "Decimated Channel", #name - 1 #number of inputs + 1024, #size + window.WIN_BLACKMAN_hARRIS, #wintype + 0, #fc + final_rate, #bw + "Decimated Channel", #name + 1, + None # parent ) self.qtgui_freq_sink_x_0_0.set_update_time(0.10) - self.qtgui_freq_sink_x_0_0.set_y_axis(-200, -60) + self.qtgui_freq_sink_x_0_0.set_y_axis((-200), (-60)) + 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(False) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) + 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 complex == type(float()): - self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True) - - labels = ["", "", "", "", "", - "", "", "", "", ""] + self.qtgui_freq_sink_x_0_0.set_fft_window_normalized(False) + + + + labels = ['', '', '', '', '', + '', '', '', '', ''] widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] + 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] + "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(1): + 1.0, 1.0, 1.0, 1.0, 1.0] + + for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: @@ -184,40 +221,45 @@ def __init__(self): 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, 3,0,3,1) + + self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.qwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 3, 0, 3, 1) + for r in range(3, 6): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(0, 1): + self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( - fft_length, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 144E6, #fc - samp_rate, #bw - "Spectrum", #name - 1 #number of inputs + fft_length, #size + window.WIN_BLACKMAN_hARRIS, #wintype + 144E6, #fc + samp_rate, #bw + "Spectrum", #name + 1, + None # parent ) self.qtgui_freq_sink_x_0.set_update_time(0.10) - self.qtgui_freq_sink_x_0.set_y_axis(-120, -20) + self.qtgui_freq_sink_x_0.set_y_axis((-120), (-20)) + self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) + self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) - - if not True: - self.qtgui_freq_sink_x_0.disable_legend() - - if complex == type(float()): - self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) - - labels = ["", "", "", "", "", - "", "", "", "", ""] + self.qtgui_freq_sink_x_0.set_fft_window_normalized(False) + + + + labels = ['', '', '', '', '', + '', '', '', '', ''] widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] + 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] + "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(1): + 1.0, 1.0, 1.0, 1.0, 1.0] + + for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: @@ -225,16 +267,22 @@ def __init__(self): self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) 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, 0,0,3,1) + + self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.qwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 3, 1) + for r in range(0, 3): + self.top_grid_layout.setRowStretch(r, 1) + for c in range(0, 1): + self.top_grid_layout.setColumnStretch(c, 1) self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff( - 16E3/float(final_rate/5), - taps=None, - flt_size=32) + (16E3/float(final_rate/5)), + taps=None, + flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) - - self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "uhd" ) + self.osmosdr_source_0 = osmosdr.source( + args="numchan=" + str(1) + " " + 'uhd' + ) + self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(center_freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) @@ -244,58 +292,69 @@ def __init__(self): self.osmosdr_source_0.set_gain(gain_db, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) - self.osmosdr_source_0.set_antenna("", 0) - self.osmosdr_source_0.set_bandwidth(samp_rate*0.8, 0) - - self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(initial_decim, (variable_low_pass_filter_taps_0), demod_bb_freq, samp_rate) - self.fir_filter_xxx_0_1 = filter.fir_filter_fff(initial_decim, (variable_low_pass_filter_taps_0)) + self.osmosdr_source_0.set_antenna('', 0) + self.osmosdr_source_0.set_bandwidth((samp_rate*0.8), 0) + self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(initial_decim, variable_low_pass_filter_taps_0, demod_bb_freq, samp_rate) + self.fir_filter_xxx_0_1 = filter.fir_filter_fff(initial_decim, variable_low_pass_filter_taps_0) self.fir_filter_xxx_0_1.declare_sample_delay(0) - self.fir_filter_xxx_0_0 = filter.fir_filter_ccc(int(samp_rate/1E6), (variable_low_pass_filter_taps_0)) + self.fir_filter_xxx_0_0 = filter.fir_filter_ccc((int(samp_rate/1E6)), variable_low_pass_filter_taps_0) self.fir_filter_xxx_0_0.declare_sample_delay(0) - self.fir_filter_xxx_0 = filter.fir_filter_ccc(initial_decim, (variable_low_pass_filter_taps_0)) + self.fir_filter_xxx_0 = filter.fir_filter_ccc(initial_decim, variable_low_pass_filter_taps_0) self.fir_filter_xxx_0.declare_sample_delay(0) - self.fft_vxx_0 = fft.fft_vcc(fft_length, True, (window.blackmanharris(fft_length)), True, 1) - self.blocks_wavfile_sink_0 = blocks.wavfile_sink(file_name, 1, 16000, 8) + self.fft_vxx_0 = fft.fft_vcc(fft_length, True, window.blackmanharris(fft_length), True, 1) + self.blocks_wavfile_sink_0 = blocks.wavfile_sink( + file_name, + 1, + 16000, + blocks.FORMAT_WAV, + blocks.FORMAT_PCM_U8, + False + ) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, fft_length) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_length) self.blocks_probe_signal_vx_0 = blocks.probe_signal_vf(fft_length) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, fft_length, 0) - self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*fft_length, int(round(samp_rate/fft_length/1000))) + self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*fft_length, (int(round(samp_rate/fft_length/1000)))) self.blocks_integrate_xx_0 = blocks.integrate_ff(100, fft_length) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_length) - self.audio_sink_0 = audio.sink(16000, "", True) + self.audio_sink_0 = audio.sink(16000, '', True) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.050) - self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_ff(-200, 0.1, 0, True) + self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_ff((-200), 0.1, 0, True) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(squelch_dB, 0.1, 0, False) + ################################################## # Connections ################################################## - self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) - self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.blocks_wavfile_sink_0, 0)) - self.connect((self.analog_quadrature_demod_cf_0, 0), (self.fir_filter_xxx_0_1, 0)) - self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0)) - self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) - self.connect((self.blocks_keep_one_in_n_0, 0), (self.fft_vxx_0, 0)) - self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_probe_signal_vx_0, 0)) - self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_vector_to_stream_0, 0)) - self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_keep_one_in_n_0, 0)) - self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_0, 0)) - self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) - self.connect((self.fir_filter_xxx_0, 0), (self.fir_filter_xxx_0_0, 0)) - self.connect((self.fir_filter_xxx_0_0, 0), (self.analog_pwr_squelch_xx_0, 0)) - self.connect((self.fir_filter_xxx_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) - self.connect((self.fir_filter_xxx_0_1, 0), (self.pfb_arb_resampler_xxx_0, 0)) - self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) - self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_pwr_squelch_xx_0_0, 0)) - self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.audio_sink_0, 0)) + self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_quadrature_demod_cf_0, 0)) + self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.blocks_wavfile_sink_0, 0)) + self.connect((self.analog_quadrature_demod_cf_0, 0), (self.fir_filter_xxx_0_1, 0)) + self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0)) + self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) + self.connect((self.blocks_keep_one_in_n_0, 0), (self.fft_vxx_0, 0)) + self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_probe_signal_vx_0, 0)) + self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_vector_to_stream_0, 0)) + self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_keep_one_in_n_0, 0)) + self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_0, 0)) + self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) + self.connect((self.fir_filter_xxx_0, 0), (self.fir_filter_xxx_0_0, 0)) + self.connect((self.fir_filter_xxx_0_0, 0), (self.analog_pwr_squelch_xx_0, 0)) + self.connect((self.fir_filter_xxx_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) + self.connect((self.fir_filter_xxx_0_1, 0), (self.pfb_arb_resampler_xxx_0, 0)) + self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0, 0)) + self.connect((self.osmosdr_source_0, 0), (self.blocks_stream_to_vector_0, 0)) + self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) + self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) + self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_pwr_squelch_xx_0_0, 0)) + self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.audio_sink_0, 0)) + def closeEvent(self, event): self.settings = Qt.QSettings("GNU Radio", "nbfm_flow_example") self.settings.setValue("geometry", self.saveGeometry()) + self.stop() + self.wait() + event.accept() def get_samp_rate(self): @@ -306,9 +365,10 @@ def set_samp_rate(self, samp_rate): self.set_final_decim(int(self.samp_rate/1E6)) self.set_final_rate(self.samp_rate/self.initial_decim**2/int(self.samp_rate/1E6)) self.set_samp_ratio(self.samp_rate/1E6) - self.blocks_keep_one_in_n_0.set_n(int(round(self.samp_rate/self.fft_length/1000))) + self.set_variable_low_pass_filter_taps_1(firdes.low_pass(1.0, self.samp_rate/25, 12.5E3, 1E3, window.WIN_HAMMING, 6.76)) + self.blocks_keep_one_in_n_0.set_n((int(round(self.samp_rate/self.fft_length/1000)))) self.osmosdr_source_0.set_sample_rate(self.samp_rate) - self.osmosdr_source_0.set_bandwidth(self.samp_rate*0.8, 0) + self.osmosdr_source_0.set_bandwidth((self.samp_rate*0.8), 0) self.qtgui_freq_sink_x_0.set_frequency_range(144E6, self.samp_rate) self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate) @@ -331,7 +391,8 @@ def get_final_rate(self): def set_final_rate(self, final_rate): self.final_rate = final_rate - self.pfb_arb_resampler_xxx_0.set_rate(16E3/float(self.final_rate/5)) + self.set_variable_low_pass_filter_taps_2(firdes.low_pass(1.0, self.final_rate, 3500, 500, window.WIN_HAMMING, 6.76)) + self.pfb_arb_resampler_xxx_0.set_rate((16E3/float(self.final_rate/5))) self.qtgui_freq_sink_x_0_0.set_frequency_range(0, self.final_rate) def get_variable_low_pass_filter_taps_2(self): @@ -351,10 +412,10 @@ def get_variable_low_pass_filter_taps_0(self): def set_variable_low_pass_filter_taps_0(self, variable_low_pass_filter_taps_0): self.variable_low_pass_filter_taps_0 = variable_low_pass_filter_taps_0 - self.fir_filter_xxx_0.set_taps((self.variable_low_pass_filter_taps_0)) - self.fir_filter_xxx_0_0.set_taps((self.variable_low_pass_filter_taps_0)) - self.fir_filter_xxx_0_1.set_taps((self.variable_low_pass_filter_taps_0)) - self.freq_xlating_fir_filter_xxx_0.set_taps((self.variable_low_pass_filter_taps_0)) + self.fir_filter_xxx_0.set_taps(self.variable_low_pass_filter_taps_0) + self.fir_filter_xxx_0_0.set_taps(self.variable_low_pass_filter_taps_0) + self.fir_filter_xxx_0_1.set_taps(self.variable_low_pass_filter_taps_0) + self.freq_xlating_fir_filter_xxx_0.set_taps(self.variable_low_pass_filter_taps_0) def get_squelch_dB(self): return self.squelch_dB @@ -388,7 +449,7 @@ def get_fft_length(self): def set_fft_length(self, fft_length): self.fft_length = fft_length - self.blocks_keep_one_in_n_0.set_n(int(round(self.samp_rate/self.fft_length/1000))) + self.blocks_keep_one_in_n_0.set_n((int(round(self.samp_rate/self.fft_length/1000)))) def get_demod_bb_freq(self): return self.demod_bb_freq @@ -405,20 +466,35 @@ def set_center_freq(self, center_freq): self.osmosdr_source_0.set_center_freq(self.center_freq, 0) -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() - from distutils.version import StrictVersion - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): - Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster')) + + +def main(top_block_cls=nbfm_flow_example, options=None): + + if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + style = gr.prefs().get_string('qtgui', 'style', 'raster') + Qt.QApplication.setGraphicsSystem(style) qapp = Qt.QApplication(sys.argv) - tb = nbfm_flow_example() + + tb = top_block_cls() + tb.start() + tb.show() - def quitting(): + def sig_handler(sig=None, frame=None): tb.stop() tb.wait() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) + + Qt.QApplication.quit() + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + + timer = Qt.QTimer() + timer.start(500) + timer.timeout.connect(lambda: None) + qapp.exec_() - tb = None # to clean up Qt widgets + +if __name__ == '__main__': + main() diff --git a/apps/parser.py b/apps/parser.py index 43830cf..7f1b4a1 100755 --- a/apps/parser.py +++ b/apps/parser.py @@ -132,24 +132,24 @@ def main(): if len(parser.parser_args) != 0: parser.print_help() #pylint: disable=maybe-no-member - raise SystemExit, 1 - - print "hw_args: " + parser.hw_args - print "num_demod: " + str(parser.num_demod) - print "type_demod: " + str(parser.type_demod) - print "center_freq: " + str(parser.center_freq) - print "ask_samp_rate: " + str(parser.ask_samp_rate) - print "gain_db: " + str(parser.gain_db) - print "if_gain_db: " + str(parser.if_gain_db) - print "bb_gain_db: " + str(parser.bb_gain_db) - print "squelch_db: " + str(parser.squelch_db) - print "volume_db: " + str(parser.volume_db) - print "threshold_db: " + str(parser.threshold_db) - print "record: " + str(parser.record) - print "lockout_file_name: " + str(parser.lockout_file_name) - print "priority_file_name: " + str(parser.priority_file_name) - print "freq_correction: " + str(parser.freq_correction) - print "audio_bps: " + str(parser.audio_bps) + raise(SystemExit, 1) + + print("hw_args: " + parser.hw_args) + print("num_demod: " + str(parser.num_demod)) + print("type_demod: " + str(parser.type_demod)) + print("center_freq: " + str(parser.center_freq)) + print("ask_samp_rate: " + str(parser.ask_samp_rate)) + print("gain_db: " + str(parser.gain_db)) + print("if_gain_db: " + str(parser.if_gain_db)) + print("bb_gain_db: " + str(parser.bb_gain_db)) + print("squelch_db: " + str(parser.squelch_db)) + print("volume_db: " + str(parser.volume_db)) + print("threshold_db: " + str(parser.threshold_db)) + print("record: " + str(parser.record)) + print("lockout_file_name: " + str(parser.lockout_file_name)) + print("priority_file_name: " + str(parser.priority_file_name)) + print("freq_correction: " + str(parser.freq_correction)) + print("audio_bps: " + str(parser.audio_bps)) if __name__ == '__main__': diff --git a/apps/receiver.py b/apps/receiver.py index be6ba2c..5505218 100755 --- a/apps/receiver.py +++ b/apps/receiver.py @@ -150,8 +150,8 @@ def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, # Low pass filter taps for decimation by 5 low_pass_filter_taps_0 = \ - grfilter.firdes_low_pass(1, 1, 0.090, 0.010, - grfilter.firdes.WIN_HAMMING) + grfilter.firdes.low_pass(1, 1, 0.090, 0.010, + window.WIN_HAMMING) # Frequency translating FIR filter decimating by 5 self.freq_xlating_fir_filter_ccc = \ @@ -166,8 +166,8 @@ def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, # Low pass filter taps for decimation from samp_rate/25 to 40-79.9 ksps # In other words, decimation by int(samp_rate/1E6) # 12.5 kHz cutoff for NBFM channel bandwidth - low_pass_filter_taps_1 = grfilter.firdes_low_pass( - 1, samp_rate/decims[0]**2, 12.5E3, 1E3, grfilter.firdes.WIN_HAMMING) + low_pass_filter_taps_1 = grfilter.firdes.low_pass( + 1, samp_rate/decims[0]**2, 12.5E3, 1E3, window.WIN_HAMMING) # FIR filter decimation by int(samp_rate/1E6) fir_filter_ccc_1 = grfilter.fir_filter_ccc(decims[1], @@ -183,9 +183,9 @@ def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, analog.quadrature_demod_cf(self.quad_demod_gain) # 3.5 kHz cutoff for audio bandwidth - low_pass_filter_taps_2 = grfilter.firdes_low_pass(1,\ + low_pass_filter_taps_2 = grfilter.firdes.low_pass(1,\ samp_rate/(decims[1] * decims[0]**2),\ - 3.5E3, 500, grfilter.firdes.WIN_HAMMING) + 3.5E3, 500, window.WIN_HAMMING) # FIR filter decimating by 5 from 40-79.9 ksps to 8-15.98 ksps fir_filter_fff_0 = grfilter.fir_filter_fff(decims[0], @@ -213,8 +213,12 @@ def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, analog_pwr_squelch_ff = analog.pwr_squelch_ff(-200, 1e-1, 0, True) # File sink with single channel and bits/sample + if audio_bps==8: + rate = blocks.FORMAT_PCM_U8 + elif audio_bps==16: + rate = blocks.FORMAT_PCM_16 self.blocks_wavfile_sink = blocks.wavfile_sink(self.file_name, 1, - audio_rate, audio_bps) + audio_rate, blocks.FORMAT_WAV, rate, False) # Connect the blocks for recording self.connect(pfb_arb_resampler_fff, analog_pwr_squelch_ff) @@ -270,7 +274,7 @@ class TunerDemodAM(BaseTuner): # pylint: disable=too-many-locals def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, - audio_bps=8): + audio_bps=blocks.FORMAT_PCM_U8): gr.hier_block2.__init__(self, "TunerDemodAM", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_float)) @@ -287,8 +291,8 @@ def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, # Low pass filter taps for decimation by 5 low_pass_filter_taps_0 = \ - grfilter.firdes_low_pass(1, 1, 0.090, 0.010, - grfilter.firdes.WIN_HAMMING) + grfilter.firdes.low_pass(1, 1, 0.090, 0.010, + window.WIN_HAMMING) # Frequency translating FIR filter decimating by 5 self.freq_xlating_fir_filter_ccc = \ @@ -303,8 +307,8 @@ def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, # Low pass filter taps for decimation from samp_rate/25 to 40-79.9 ksps # In other words, decimation by int(samp_rate/1E6) # 12.5 kHz cutoff for NBFM channel bandwidth - low_pass_filter_taps_1 = grfilter.firdes_low_pass( - 1, samp_rate/decims[0]**2, 12.5E3, 1E3, grfilter.firdes.WIN_HAMMING) + low_pass_filter_taps_1 = grfilter.firdes.low_pass( + 1, samp_rate/decims[0]**2, 12.5E3, 1E3, window.WIN_HAMMING) # FIR filter decimation by int(samp_rate/1E6) fir_filter_ccc_1 = grfilter.fir_filter_ccc(decims[1], @@ -325,9 +329,9 @@ def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, am_demod_cf = blocks.complex_to_mag(1) # 3.5 kHz cutoff for audio bandwidth - low_pass_filter_taps_2 = grfilter.firdes_low_pass(1,\ + low_pass_filter_taps_2 = grfilter.firdes.low_pass(1,\ samp_rate/(decims[1] * decims[0]**2),\ - 3.5E3, 500, grfilter.firdes.WIN_HAMMING) + 3.5E3, 500, window.WIN_HAMMING) # FIR filter decimating by 5 from 40-79.9 ksps to 8-15.98 ksps fir_filter_fff_0 = grfilter.fir_filter_fff(decims[0], @@ -355,8 +359,12 @@ def __init__(self, samp_rate=4E6, audio_rate=8000, record=True, analog_pwr_squelch_ff = analog.pwr_squelch_ff(-200, 1e-1, 0, True) # File sink with single channel and 8 bits/sample + if audio_bps == 8: + rate = blocks.FORMAT_PCM_U8 + elif audio_bps == 16: + rate = blocks.FORMAT_PCM_16 self.blocks_wavfile_sink = blocks.wavfile_sink(self.file_name, 1, - audio_rate, audio_bps) + audio_rate, blocks.FORMAT_WAV, rate, False) # Connect the blocks for recording self.connect(pfb_arb_resampler_fff, analog_pwr_squelch_ff) @@ -601,14 +609,14 @@ def main(): center_freq = 144.5E6 receiver.set_center_freq(center_freq) receiver.set_gain(10) - print "\n" - print "Started %s at %.3f Msps" % (hw_args, receiver.samp_rate/1E6) - print "RX at %.3f MHz with %d dB gain" % (receiver.center_freq/1E6, - receiver.gain_db) + print("\n") + print("Started %s at %.3f Msps" % (hw_args, receiver.samp_rate/1E6)) + print("RX at %.3f MHz with %d dB gain" % (receiver.center_freq/1E6, + receiver.gain_db)) receiver.set_squelch(-60) receiver.set_volume(0) - print "%d demods of type %d at %d dB squelch and %d dB volume" % \ - (num_demod, type_demod, receiver.squelch_db, receiver.volume_db) + print("%d demods of type %d at %d dB squelch and %d dB volume" % \ + (num_demod, type_demod, receiver.squelch_db, receiver.volume_db)) # Create some baseband channels to tune based on 144 MHz center channels = np.zeros(num_demod) @@ -622,9 +630,9 @@ def main(): # Print demodulator info for idx, channel in enumerate(channels): - print "Tuned demod %d to %.3f MHz" % (idx, + print("Tuned demod %d to %.3f MHz" % (idx, (channel+receiver.center_freq) - /1E6) + /1E6)) while 1: # No need to go faster than 10 Hz rate of GNU Radio probe @@ -633,7 +641,7 @@ def main(): # Grab the FFT data and print max value spectrum = receiver.probe_signal_vf.level() - print "Max spectrum of %.3f" % (np.max(spectrum)) + print("Max spectrum of %.3f" % (np.max(spectrum))) # Stop the receiver receiver.stop() diff --git a/apps/scanner.py b/apps/scanner.py index 619f192..000d1da 100755 --- a/apps/scanner.py +++ b/apps/scanner.py @@ -5,7 +5,10 @@ @author: madengr """ -import __builtin__ +try: + import builtins +except: + import __builtin__ import receiver as recvr import estimate import parser as prsr @@ -348,7 +351,7 @@ def main(): if len(parser.parser_args) != 0: parser.print_help() #pylint: disable=maybe-no-member - raise SystemExit, 1 + raise(SystemExit, 1) # Create scanner object ask_samp_rate = parser.ask_samp_rate @@ -369,14 +372,14 @@ def main(): scanner.set_gain(parser.gain_db) scanner.set_if_gain(parser.if_gain_db) scanner.set_bb_gain(parser.bb_gain_db) - print "\n" - print "Started %s at %.3f Msps" % (hw_args, scanner.samp_rate/1E6) - print "RX at %.3f MHz with %d dB gain" % (scanner.center_freq/1E6, - scanner.gain_db) + print("\n") + print("Started %s at %.3f Msps" % (hw_args, scanner.samp_rate/1E6)) + print("RX at %.3f MHz with %d dB gain" % (scanner.center_freq/1E6, + scanner.gain_db)) scanner.set_squelch(parser.squelch_db) scanner.set_volume(parser.volume_db) - print "%d demods of type %d at %d dB squelch and %d dB volume" % \ - (num_demod, type_demod, scanner.squelch_db, scanner.volume_db) + print("%d demods of type %d at %d dB squelch and %d dB volume" % \ + (num_demod, type_demod, scanner.squelch_db, scanner.volume_db)) # Create this epmty list to allow printing to screen old_gui_tuned_channels = []