def __init__(self): gr.top_block.__init__(self, "Hd Tx Rtl File") ################################################## # Blocks ################################################## self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=2, decimation=1, taps=None, fractional_bw=None) self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD') self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist') self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176) self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000) self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1) self.blocks_wavfile_source_0 = blocks.wavfile_source('sample.wav', True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 2048) self.blocks_vector_source_x_0 = blocks.vector_source_c([math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048-112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, []) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*2048, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.5) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_interleave_0 = blocks.interleave(gr.sizeof_float*1, 1) self.blocks_float_to_uchar_0 = blocks.float_to_uchar() self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, 'hd-generated.raw', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_add_const_vxx_0_0 = blocks.add_const_ff(127.5) ################################################## # Connections ################################################## self.connect((self.blocks_add_const_vxx_0_0, 0), (self.blocks_float_to_uchar_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_interleave_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_interleave_0, 1)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_interleave_0, 0), (self.blocks_add_const_vxx_0_0, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0)) self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1)) self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_const_vxx_0, 0))
def test_instance(self): instance = l1_fm_encoder(psm=1) instance = l1_fm_encoder(psm=2) instance = l1_fm_encoder(psm=3) instance = l1_fm_encoder(psm=11) instance = l1_fm_encoder(psm=5) instance = l1_fm_encoder(psm=5, ssm=1) instance = l1_fm_encoder(psm=5, ssm=2) instance = l1_fm_encoder(psm=5, ssm=3) instance = l1_fm_encoder(psm=5, ssm=4) instance = l1_fm_encoder(psm=6) instance = l1_fm_encoder(psm=6, ssm=1) instance = l1_fm_encoder(psm=6, ssm=2) instance = l1_fm_encoder(psm=6, ssm=3) instance = l1_fm_encoder(psm=6, ssm=4)
def __init__(self): gr.top_block.__init__(self, "Hd Tx Usrp", catch_exceptions=True) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 87.5e6 self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", '')), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), '', ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec(0)) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_gain(70, 0) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=100, decimation=21, taps=[], fractional_bw=-1.0) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=50, decimation=21, taps=[], fractional_bw=-1.0) self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD') self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist') self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176) self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(0.1, samp_rate, 80000, 20000, window.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1) self.blocks_wavfile_source_1 = blocks.wavfile_source( 'sample_mono.wav', True) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'sample.wav', True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 2048) self.blocks_vector_source_x_0 = blocks.vector_source_c( [math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048 - 112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, []) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 2048, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.001) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, int(audio_rate * 3.5)) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_delay_0, 0), (self.analog_wfm_tx_0_0, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_delay_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0)) self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1)) self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Hackrf") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 87.5e6 self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=None, fractional_bw=None) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc( interpolation=100, decimation=21, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=50, decimation=21, taps=None, fractional_bw=None) self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + "") self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(0, 0) self.osmosdr_sink_0.set_if_gain(40, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD') self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist') self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176) self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(0.1, samp_rate, 80000, 20000, firdes.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1) self.blocks_wavfile_source_1 = blocks.wavfile_source( 'sample_mono.wav', True) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'sample.wav', True) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 2048) self.blocks_vector_source_x_0 = blocks.vector_source_c( [math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048 - 112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, []) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 2048, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.001) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, int(audio_rate * 3.5)) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_delay_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.blocks_wavfile_source_1, 0), (self.blocks_delay_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.fft_vxx_0, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0)) self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1)) self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Hd Tx Usrp") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 self.freq = freq = 95.7e6 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "send_frame_size=65536,num_send_frames=128")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(freq, 0) self.uhd_usrp_sink_0.set_gain(70, 0) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=256, decimation=243, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=125, decimation=49, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=samp_rate / 200000, decimation=1, taps=None, fractional_bw=None, ) self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD') self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist') self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176) self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1) self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 80000, 20000, firdes.WIN_HAMMING, 6.76)) self.fft_vxx_0 = fft.fft_vcc(2048, False, (window.rectangular(2048)), True, 1) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( (-1 - 1j, -1 + 1j, 1 - 1j, 1 + 1j, 0), 1) self.blocks_wavfile_source_0 = blocks.wavfile_source( 'sample.wav', True) self.blocks_vector_to_stream_1 = blocks.vector_to_stream( gr.sizeof_char * 1, 1048576) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, 2048) self.blocks_vector_source_x_0 = blocks.vector_source_c( [math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048 - 112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, []) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 2048) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 2048, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.1, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.001, )) self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=50000, quad_rate=200000, tau=75e-6, max_dev=75e3, fh=-1.0, ) self.analog_sig_source_x_0 = analog.sig_source_f( 50000, analog.GR_COS_WAVE, 1000, 0.1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0)) self.connect((self.blocks_vector_to_stream_1, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0)) self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.blocks_vector_to_stream_1, 0)) self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0)) self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1)) self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_const_vxx_0, 0))