From 1cf8c2f6dbfb2f7fb9f2c5dd1e82ca7b1e62c538 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 24 Nov 2021 22:28:23 +0100 Subject: [PATCH] Reverse engineered loop from gnuradio --- .gitignore | 2 + audio_costas.grc | 623 +++++++++++++++++++++++++++++++++++++++++ costas.c | 71 ++--- from_audio.grc | 422 ++++++++++++++++++++++++++++ resample_recording.grc | 261 +++++++++++++++++ view_waterfall.grc | 4 +- wobble.grc | 25 +- 7 files changed, 1363 insertions(+), 45 deletions(-) create mode 100644 .gitignore create mode 100644 audio_costas.grc create mode 100644 from_audio.grc create mode 100644 resample_recording.grc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a75201 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.raw +*.py diff --git a/audio_costas.grc b/audio_costas.grc new file mode 100644 index 0000000..fc1a400 --- /dev/null +++ b/audio_costas.grc @@ -0,0 +1,623 @@ +options: + parameters: + author: sebastian + catch_exceptions: 'True' + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: from_audio + 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: Not titled yet + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 8] + rotation: 0 + state: enabled + +blocks: +- name: enable_loop + id: variable_qtgui_check_box + parameters: + comment: '' + 'false': '0' + gui_hint: '' + label: Enable + 'true': '1' + type: real + value: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1968, 284.0] + rotation: 0 + state: true +- name: samp_rate + id: variable + parameters: + comment: '' + value: '100000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 12] + rotation: 0 + state: enabled +- name: analog_agc2_xx_0 + id: analog_agc2_xx + parameters: + affinity: '' + alias: '' + attack_rate: '0.03' + comment: '' + decay_rate: '0.3' + gain: '10' + max_gain: '65536' + maxoutbuf: '0' + minoutbuf: '0' + reference: '0.9' + type: complex + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1472, 188.0] + rotation: 0 + state: true +- name: analog_noise_source_x_0 + id: analog_noise_source_x + parameters: + affinity: '' + alias: '' + amp: '0.001' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + noise_type: analog.GR_GAUSSIAN + seed: '0' + type: complex + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [440, 204.0] + rotation: 0 + state: true +- name: analog_sig_source_x_0 + id: analog_sig_source_x + parameters: + affinity: '' + alias: '' + amp: '1' + comment: '' + freq: '25000' + maxoutbuf: '0' + minoutbuf: '0' + offset: '0' + phase: '0' + samp_rate: samp_rate + type: complex + waveform: analog.GR_COS_WAVE + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [416, 284.0] + rotation: 0 + state: true +- name: analog_sig_source_x_0_0 + id: analog_sig_source_x + parameters: + affinity: '' + alias: '' + amp: '1' + comment: '' + freq: '0.05' + maxoutbuf: '0' + minoutbuf: '0' + offset: '0' + phase: '0' + samp_rate: samp_rate + type: float + waveform: analog.GR_COS_WAVE + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [408, 420.0] + rotation: 0 + state: true +- name: analog_sig_source_x_0_1 + id: analog_sig_source_x + parameters: + affinity: '' + alias: '' + amp: '1' + comment: '' + freq: '-25000' + maxoutbuf: '0' + minoutbuf: '0' + offset: '0' + phase: '0' + samp_rate: samp_rate + type: complex + waveform: analog.GR_COS_WAVE + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1016, 348.0] + rotation: 0 + state: true +- name: audio_source_0 + id: audio_source + parameters: + affinity: '' + alias: '' + comment: '' + device_name: '' + maxoutbuf: '0' + minoutbuf: '0' + num_outputs: '1' + ok_to_block: 'True' + samp_rate: '48000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [88, 172.0] + rotation: 0 + state: true +- name: band_pass_filter_0 + id: band_pass_filter + parameters: + affinity: '' + alias: '' + beta: '6.76' + comment: '' + decim: '1' + gain: '1' + high_cutoff_freq: '10000' + interp: '1' + low_cutoff_freq: '0' + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: samp_rate + type: fir_filter_fcc + width: '100' + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [480, 44.0] + rotation: 0 + state: true +- name: blocks_add_xx_0 + id: blocks_add_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [672, 104.0] + rotation: 0 + state: true +- name: blocks_multiply_const_xx_0 + id: blocks_multiply_const_xx + parameters: + affinity: '' + alias: '' + comment: '' + const: enable_loop + maxoutbuf: '0' + minoutbuf: '0' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1892.0, 272] + rotation: 270 + state: true +- name: blocks_multiply_xx_0 + id: blocks_multiply_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [752, 176.0] + rotation: 0 + state: true +- name: blocks_multiply_xx_0_0 + id: blocks_multiply_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [888, 192.0] + rotation: 0 + state: true +- name: blocks_multiply_xx_1 + id: blocks_multiply_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1352, 208.0] + rotation: 0 + state: true +- name: blocks_multiply_xx_2 + id: blocks_multiply_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1664, 456.0] + rotation: 0 + state: true +- name: blocks_vco_c_0 + id: blocks_vco_c + parameters: + affinity: '' + alias: '' + amplitude: '1.0' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: samp_rate + sensitivity: '5000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [712, 444.0] + rotation: 0 + state: true +- name: blocks_vco_c_1 + id: blocks_vco_c + parameters: + affinity: '' + alias: '' + amplitude: '1.0' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: samp_rate + sensitivity: '-100000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1664, 332.0] + rotation: 180 + state: true +- name: digital_costas_loop_cc_0 + id: digital_costas_loop_cc + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + order: '2' + use_snr: 'True' + w: '0.03' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1672, 192.0] + rotation: 0 + state: true +- 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: '0' + fftsize: '4096' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + label: Relative Gain + label1: '' + label10: '''''' + label2: '''''' + label3: '''''' + label4: '''''' + label5: '''''' + label6: '''''' + label7: '''''' + label8: '''''' + label9: '''''' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '"Loop Output"' + nconnections: '1' + norm_window: 'False' + showports: 'False' + 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: '10' + ymin: '-140' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1880, 92.0] + rotation: 0 + state: true +- name: qtgui_waterfall_sink_x_0 + id: qtgui_waterfall_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' + axislabels: 'True' + bw: samp_rate + color1: '0' + color10: '0' + color2: '0' + color3: '0' + color4: '0' + color5: '0' + color6: '0' + color7: '0' + color8: '0' + color9: '0' + comment: '' + fc: '0' + fftsize: '4096' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + int_max: '10' + int_min: '-140' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '"Input"' + nconnections: '1' + showports: 'False' + type: complex + update_time: '0.10' + wintype: window.WIN_BLACKMAN_hARRIS + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1032, 92.0] + rotation: 0 + state: true +- name: qtgui_waterfall_sink_x_0_0 + id: qtgui_waterfall_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' + axislabels: 'True' + bw: samp_rate + color1: '0' + color10: '0' + color2: '0' + color3: '0' + color4: '0' + color5: '0' + color6: '0' + color7: '0' + color8: '0' + color9: '0' + comment: '' + fc: '0' + fftsize: '4096' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + int_max: '10' + int_min: '-140' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '"Stabilzed Output"' + nconnections: '1' + showports: 'False' + type: complex + update_time: '0.10' + wintype: window.WIN_BLACKMAN_hARRIS + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1848, 452.0] + rotation: 0 + state: true +- name: rational_resampler_xxx_0 + id: rational_resampler_xxx + parameters: + affinity: '' + alias: '' + comment: '' + decim: '48000' + fbw: '0' + interp: samp_rate + maxoutbuf: '0' + minoutbuf: '0' + taps: '[]' + type: fff + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [288, 148.0] + rotation: 0 + state: true + +connections: +- [analog_agc2_xx_0, '0', digital_costas_loop_cc_0, '0'] +- [analog_noise_source_x_0, '0', blocks_add_xx_0, '1'] +- [analog_sig_source_x_0, '0', blocks_multiply_xx_0, '1'] +- [analog_sig_source_x_0_0, '0', blocks_vco_c_0, '0'] +- [analog_sig_source_x_0_1, '0', blocks_multiply_xx_1, '1'] +- [audio_source_0, '0', rational_resampler_xxx_0, '0'] +- [band_pass_filter_0, '0', blocks_add_xx_0, '0'] +- [blocks_add_xx_0, '0', blocks_multiply_xx_0, '0'] +- [blocks_multiply_const_xx_0, '0', blocks_vco_c_1, '0'] +- [blocks_multiply_xx_0, '0', blocks_multiply_xx_0_0, '0'] +- [blocks_multiply_xx_0_0, '0', blocks_multiply_xx_1, '0'] +- [blocks_multiply_xx_0_0, '0', blocks_multiply_xx_2, '1'] +- [blocks_multiply_xx_0_0, '0', qtgui_waterfall_sink_x_0, '0'] +- [blocks_multiply_xx_1, '0', analog_agc2_xx_0, '0'] +- [blocks_multiply_xx_2, '0', qtgui_waterfall_sink_x_0_0, '0'] +- [blocks_vco_c_0, '0', blocks_multiply_xx_0_0, '1'] +- [blocks_vco_c_1, '0', blocks_multiply_xx_2, '0'] +- [digital_costas_loop_cc_0, '0', qtgui_freq_sink_x_0, '0'] +- [digital_costas_loop_cc_0, '1', blocks_multiply_const_xx_0, '0'] +- [rational_resampler_xxx_0, '0', band_pass_filter_0, '0'] + +metadata: + file_format: 1 diff --git a/costas.c b/costas.c index 441b2d0..74bee8d 100644 --- a/costas.c +++ b/costas.c @@ -6,23 +6,6 @@ const float SAMPLINGRATE = 100000.0; const float EXPECTED_CENTER = 25000.0; -// 15khz lowpass -float LOWPASS_COEFFS[37] = { - -0.0013484122464433312,-0.0015524507034569979,-0.0012626417446881533, - 1.106597777377648e-18,0.0025128561537712812,0.005701862741261721, - 0.007837646640837193,0.006523041054606438,-3.595113471383589e-18, - -0.011250422336161137,-0.02350831776857376,-0.03022352233529091, - -0.02406340278685093,6.529514774129222e-18,0.04183189943432808, - 0.09489838778972626,0.14748811721801758,0.18619666993618011, - 0.20043739676475525,0.18619666993618011,0.14748811721801758, - 0.09489838778972626,0.04183189943432808,6.529514774129222e-18, - -0.02406340278685093,-0.03022352233529091,-0.02350831776857376, - -0.011250422336161137,-3.595113471383589e-18,0.006523041054606438, - 0.007837646640837193,0.005701862741261721,0.0025128561537712812, - 1.106597777377648e-18,-0.0012626417446881533,-0.0015524507034569979, - -0.0013484122464433312 -}; - int main() { // create the NCO object @@ -31,21 +14,27 @@ int main() { float freq = -(2 * M_PI * EXPECTED_CENTER) / SAMPLINGRATE; nco_crcf_set_frequency(downmix, freq); - nco_crcf costas_vco = nco_crcf_create(LIQUID_VCO); - nco_crcf_set_phase(costas_vco, 0.0f); - nco_crcf_set_frequency(costas_vco, 0); - - - firfilt_rrrf r_fir = firfilt_rrrf_create(LOWPASS_COEFFS, 37); - firfilt_rrrf i_fir = firfilt_rrrf_create(LOWPASS_COEFFS, 37); + agc_crcf agc = agc_crcf_create(); // create object + agc_crcf_set_bandwidth(agc,1e-3f); // set loop filter bandwidth // output complex exponential float complex x; FILE* output = fopen("output.raw", "w"); - FILE* input = fopen("wobble.raw", "r"); + FILE* input = fopen("middle_beacon.raw", "r"); - float vco_freq = 0.0; + float loop_bw = 0.3; + float min_freq = -1.0; + float max_freq = 1.0; + // Set the damping factor for a critically damped system + float damping = sqrtf(2.0f) / 2.0f; + float denom = (1.0 + 2.0 * damping * loop_bw + loop_bw * loop_bw); + float alpha = (4 * damping * loop_bw) / denom; + float beta = (4 * loop_bw * loop_bw) / denom; + + + float loop_freq = 0.0; + float loop_phase = 0.0; float in[2]; while(fread(in, sizeof(float), 2, input) == 2) { @@ -54,28 +43,33 @@ int main() { // compute complex exponential nco_crcf_cexpf(downmix, &x); - float complex y; - nco_crcf_step(costas_vco); - nco_crcf_cexpf(costas_vco, &y); + float complex y = cos(-loop_phase) + I * sin(-loop_phase); float complex input_sample = (in[0] + I * in[1]); float complex downmix_sample = input_sample * x; + + agc_crcf_execute(agc, downmix_sample, &downmix_sample); + float complex costas_sample = downmix_sample * y; float complex output_sample = input_sample * y; float r_sample = creal(costas_sample); float i_sample = cimag(costas_sample); - firfilt_rrrf_push(r_fir, r_sample); // push input sample - firfilt_rrrf_execute(r_fir,&r_sample); // compute output - - firfilt_rrrf_push(i_fir, i_sample); // push input sample - firfilt_rrrf_execute(i_fir,&i_sample); // compute output - float error = i_sample * r_sample; - vco_freq += error * 0.1; - nco_crcf_set_frequency(costas_vco, -vco_freq); + loop_freq += beta * error; + loop_phase += loop_freq + alpha * error; + + while(loop_phase > (2 * M_PI)) + loop_phase -= 2 * M_PI; + while(loop_phase < (-2 * M_PI)) + loop_phase += 2 * M_PI; + + if(loop_freq > max_freq) + loop_freq = max_freq; + else if(loop_freq < min_freq) + loop_freq = min_freq; float buffer[] = {creal(output_sample), cimag(output_sample)}; fwrite(buffer, sizeof(float), 2, output); @@ -83,10 +77,7 @@ int main() { // destroy nco object nco_crcf_destroy(downmix); - nco_crcf_destroy(costas_vco); - firfilt_rrrf_destroy(r_fir); - firfilt_rrrf_destroy(i_fir); fclose(output); fclose(input); diff --git a/from_audio.grc b/from_audio.grc new file mode 100644 index 0000000..8fbd771 --- /dev/null +++ b/from_audio.grc @@ -0,0 +1,422 @@ +options: + parameters: + author: sebastian + catch_exceptions: 'True' + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: from_audio + 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: Not titled yet + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 8] + rotation: 0 + state: enabled + +blocks: +- name: samp_rate + id: variable + parameters: + comment: '' + value: '100000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 12] + rotation: 0 + state: enabled +- name: analog_noise_source_x_0 + id: analog_noise_source_x + parameters: + affinity: '' + alias: '' + amp: '0.001' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + noise_type: analog.GR_GAUSSIAN + seed: '0' + type: complex + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [384, 212.0] + rotation: 0 + state: true +- name: analog_sig_source_x_0 + id: analog_sig_source_x + parameters: + affinity: '' + alias: '' + amp: '1' + comment: '' + freq: '25000' + maxoutbuf: '0' + minoutbuf: '0' + offset: '0' + phase: '0' + samp_rate: samp_rate + type: complex + waveform: analog.GR_COS_WAVE + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [360, 292.0] + rotation: 0 + state: true +- name: analog_sig_source_x_0_0 + id: analog_sig_source_x + parameters: + affinity: '' + alias: '' + amp: '1' + comment: '' + freq: '0.05' + maxoutbuf: '0' + minoutbuf: '0' + offset: '0' + phase: '0' + samp_rate: samp_rate + type: float + waveform: analog.GR_COS_WAVE + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [352, 420.0] + rotation: 0 + state: true +- name: audio_source_0 + id: audio_source + parameters: + affinity: '' + alias: '' + comment: '' + device_name: '' + maxoutbuf: '0' + minoutbuf: '0' + num_outputs: '1' + ok_to_block: 'True' + samp_rate: '48000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [32, 172.0] + rotation: 0 + state: true +- name: band_pass_filter_0 + id: band_pass_filter + parameters: + affinity: '' + alias: '' + beta: '6.76' + comment: '' + decim: '1' + gain: '1' + high_cutoff_freq: '10000' + interp: '1' + low_cutoff_freq: '0' + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: samp_rate + type: fir_filter_fcc + width: '100' + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [424, 52.0] + rotation: 0 + state: true +- name: blocks_add_xx_0 + id: blocks_add_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [616, 104.0] + rotation: 0 + state: true +- name: blocks_file_sink_0 + id: blocks_file_sink + parameters: + affinity: '' + alias: '' + append: 'False' + comment: '' + file: /home/sebastian/projects/QO100-trx/prototypes/middle_beacon.raw + type: complex + unbuffered: 'False' + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1016, 300.0] + rotation: 0 + state: true +- name: blocks_multiply_xx_0 + id: blocks_multiply_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [696, 176.0] + rotation: 0 + state: true +- name: blocks_multiply_xx_0_0 + id: blocks_multiply_xx + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [832, 192.0] + rotation: 0 + state: true +- name: blocks_vco_c_0 + id: blocks_vco_c + parameters: + affinity: '' + alias: '' + amplitude: '1.0' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: samp_rate + sensitivity: '5000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [656, 444.0] + rotation: 0 + state: true +- 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: '0' + fftsize: '4096' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + label: Relative Gain + label1: '' + label10: '''''' + label2: '''''' + label3: '''''' + label4: '''''' + label5: '''''' + label6: '''''' + label7: '''''' + label8: '''''' + label9: '''''' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '""' + nconnections: '1' + norm_window: 'False' + showports: 'False' + 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: '10' + ymin: '-140' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1016, 60.0] + rotation: 0 + state: true +- name: qtgui_waterfall_sink_x_0 + id: qtgui_waterfall_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' + axislabels: 'True' + bw: samp_rate + color1: '0' + color10: '0' + color2: '0' + color3: '0' + color4: '0' + color5: '0' + color6: '0' + color7: '0' + color8: '0' + color9: '0' + comment: '' + fc: '0' + fftsize: '4096' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + int_max: '10' + int_min: '-140' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '""' + nconnections: '1' + showports: 'False' + type: complex + update_time: '0.10' + wintype: window.WIN_BLACKMAN_hARRIS + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1016, 188.0] + rotation: 0 + state: true +- name: rational_resampler_xxx_0 + id: rational_resampler_xxx + parameters: + affinity: '' + alias: '' + comment: '' + decim: '48000' + fbw: '0' + interp: samp_rate + maxoutbuf: '0' + minoutbuf: '0' + taps: '[]' + type: fff + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [232, 148.0] + rotation: 0 + state: true + +connections: +- [analog_noise_source_x_0, '0', blocks_add_xx_0, '1'] +- [analog_sig_source_x_0, '0', blocks_multiply_xx_0, '1'] +- [analog_sig_source_x_0_0, '0', blocks_vco_c_0, '0'] +- [audio_source_0, '0', rational_resampler_xxx_0, '0'] +- [band_pass_filter_0, '0', blocks_add_xx_0, '0'] +- [blocks_add_xx_0, '0', blocks_multiply_xx_0, '0'] +- [blocks_multiply_xx_0, '0', blocks_multiply_xx_0_0, '0'] +- [blocks_multiply_xx_0_0, '0', blocks_file_sink_0, '0'] +- [blocks_multiply_xx_0_0, '0', qtgui_freq_sink_x_0, '0'] +- [blocks_multiply_xx_0_0, '0', qtgui_waterfall_sink_x_0, '0'] +- [blocks_vco_c_0, '0', blocks_multiply_xx_0_0, '1'] +- [rational_resampler_xxx_0, '0', band_pass_filter_0, '0'] + +metadata: + file_format: 1 diff --git a/resample_recording.grc b/resample_recording.grc new file mode 100644 index 0000000..6de2af6 --- /dev/null +++ b/resample_recording.grc @@ -0,0 +1,261 @@ +options: + parameters: + author: sebastian + catch_exceptions: 'True' + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: resample_recording + 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: Not titled yet + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 8] + rotation: 0 + state: enabled + +blocks: +- name: samp_rate + id: variable + parameters: + comment: '' + value: '100000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 12] + rotation: 0 + state: enabled +- name: blocks_file_sink_0 + id: blocks_file_sink + parameters: + affinity: '' + alias: '' + append: 'False' + comment: '' + file: /home/sebastian/projects/QO100-trx/prototypes/middle_beacon.raw + type: complex + unbuffered: 'False' + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [688, 188.0] + rotation: 0 + state: true +- name: blocks_file_source_0 + id: blocks_file_source + parameters: + affinity: '' + alias: '' + begin_tag: pmt.PMT_NIL + comment: '' + file: /home/sebastian/gqrx_20211122_222200_432741000_1000000_fc.raw + length: '0' + maxoutbuf: '0' + minoutbuf: '0' + offset: '0' + repeat: 'False' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [72, 172.0] + rotation: 0 + state: true +- name: blocks_throttle_0 + id: blocks_throttle + parameters: + affinity: '' + alias: '' + comment: '' + ignoretag: 'True' + maxoutbuf: '0' + minoutbuf: '0' + samples_per_second: '1000000' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [304, 204.0] + rotation: 0 + state: true +- name: low_pass_filter_0 + id: low_pass_filter + parameters: + affinity: '' + alias: '' + beta: '6.76' + comment: '' + cutoff_freq: '45000' + decim: '10' + gain: '1' + interp: '1' + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: samp_rate + type: fir_filter_ccf + width: '5000' + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [464, 156.0] + rotation: 0 + state: true +- name: qtgui_waterfall_sink_x_0 + id: qtgui_waterfall_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' + axislabels: 'True' + bw: samp_rate + color1: '0' + color10: '0' + color2: '0' + color3: '0' + color4: '0' + color5: '0' + color6: '0' + color7: '0' + color8: '0' + color9: '0' + comment: '' + fc: '0' + fftsize: '4096' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + int_max: '10' + int_min: '-140' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '""' + nconnections: '1' + showports: 'False' + type: complex + update_time: '0.10' + wintype: window.WIN_BLACKMAN_hARRIS + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [696, 52.0] + rotation: 0 + state: true +- name: qtgui_waterfall_sink_x_0_0 + id: qtgui_waterfall_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' + axislabels: 'True' + bw: '1000000' + color1: '0' + color10: '0' + color2: '0' + color3: '0' + color4: '0' + color5: '0' + color6: '0' + color7: '0' + color8: '0' + color9: '0' + comment: '' + fc: '0' + fftsize: '4096' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + int_max: '10' + int_min: '-140' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '""' + nconnections: '1' + showports: 'False' + type: complex + update_time: '0.10' + wintype: window.WIN_BLACKMAN_hARRIS + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [456, 36.0] + rotation: 0 + state: true + +connections: +- [blocks_file_source_0, '0', blocks_throttle_0, '0'] +- [blocks_throttle_0, '0', low_pass_filter_0, '0'] +- [blocks_throttle_0, '0', qtgui_waterfall_sink_x_0_0, '0'] +- [low_pass_filter_0, '0', blocks_file_sink_0, '0'] +- [low_pass_filter_0, '0', qtgui_waterfall_sink_x_0, '0'] + +metadata: + file_format: 1 diff --git a/view_waterfall.grc b/view_waterfall.grc index bba1fbd..372fa7e 100644 --- a/view_waterfall.grc +++ b/view_waterfall.grc @@ -73,7 +73,7 @@ blocks: alias: '' begin_tag: pmt.PMT_NIL comment: '' - file: /home/sebastian/projects/QO100-trx/prototypes/wobble.raw + file: /home/sebastian/projects/QO100-trx/prototypes/middle_beacon.raw length: '0' maxoutbuf: '0' minoutbuf: '0' @@ -85,7 +85,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [184, 92.0] + coordinate: [176, 92.0] rotation: 0 state: true - name: blocks_throttle_0 diff --git a/wobble.grc b/wobble.grc index c420fac..85d08e3 100644 --- a/wobble.grc +++ b/wobble.grc @@ -95,11 +95,11 @@ blocks: alias: '' amp: '1' comment: '' - freq: '0.05' + freq: '0.01' maxoutbuf: '0' minoutbuf: '0' offset: '-0.5' - phase: '0' + phase: 3.14159265358 / 2 samp_rate: samp_rate type: float waveform: analog.GR_TRI_WAVE @@ -146,6 +146,24 @@ blocks: coordinate: [1344, 340.0] rotation: 0 state: true +- name: blocks_multiply_const_vxx_0 + id: blocks_multiply_const_vxx + parameters: + affinity: '' + alias: '' + comment: '' + const: '-1' + maxoutbuf: '0' + minoutbuf: '0' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [520, 516.0] + rotation: 0 + state: true - name: blocks_multiply_xx_0 id: blocks_multiply_xx parameters: @@ -266,8 +284,9 @@ blocks: connections: - [analog_sig_source_x_0, '0', blocks_add_xx_0, '0'] - [analog_sig_source_x_1, '0', blocks_add_xx_0, '1'] -- [analog_sig_source_x_1_0, '0', blocks_vco_c_0, '0'] +- [analog_sig_source_x_1_0, '0', blocks_multiply_const_vxx_0, '0'] - [blocks_add_xx_0, '0', blocks_multiply_xx_0, '0'] +- [blocks_multiply_const_vxx_0, '0', blocks_vco_c_0, '0'] - [blocks_multiply_xx_0, '0', blocks_throttle_0, '0'] - [blocks_throttle_0, '0', blocks_file_sink_0, '0'] - [blocks_throttle_0, '0', qtgui_waterfall_sink_x_0, '0']