GNU Radio World

Rational Resampler Demo

Adapted from GNU Radio's own example (gr-filter/examples/resampler_demo.grc). The QT GUI Label variables become plain variables so their values survive.

Press Load to open this flowgraph in an editor embedded above, then ▶ to run it. Nothing is downloaded until you do.

Open in the full editor ▶ Download the .grc

Blocks used

BlockModuleUsed
VariableGNU Radio5
QT GUI Frequency SinkGNU Radio2
Add ConstGNU Radio1
Frequency ModGNU Radio1
Polyphase Arbitrary ResamplerGNU Radio1
Signal SourceGNU Radio1
ThrottleGNU Radio1

Flowgraph source

filter/resampler.grc
options:
  parameters:
    author: ''
    catch_exceptions: 'True'
    category: Custom
    cmake_opt: ''
    comment: ''
    copyright: ''
    description: Adapted from GNU Radio's own example (gr-filter/examples/resampler_demo.grc). The QT GUI Label variables
      become plain variables so their values survive.
    gen_cmake: 'On'
    gen_linking: dynamic
    generate_options: qt_gui
    hier_block_src_path: '.:'
    id: resampler_demo
    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: Rational Resampler Demo
    window_size: 1280, 1024
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [10, 10]
    rotation: 0
    state: enabled
blocks:
- name: frac_bw
  id: variable
  parameters:
    comment: ''
    value: '.45'
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [590, 10]
    rotation: 0
    state: enabled
- name: new_rate
  id: variable
  parameters:
    comment: ''
    value: '48000'
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [760, 10]
    rotation: 0
    state: enabled
- name: nphases
  id: variable
  parameters:
    comment: ''
    value: '32'
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [930, 10]
    rotation: 0
    state: enabled
- name: rs_taps
  id: variable
  parameters:
    comment: ''
    value: firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [1100, 10]
    rotation: 0
    state: enabled
- name: samp_rate
  id: variable
  parameters:
    comment: ''
    value: '44100'
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [1400, 10]
    rotation: 0
    state: enabled
- name: adder
  id: blocks_add_const_vxx
  parameters:
    affinity: ''
    alias: ''
    comment: ''
    const: '-1.0'
    maxoutbuf: '0'
    minoutbuf: '0'
    type: float
    vlen: '1'
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [310, 210]
    rotation: 0
    state: enabled
- name: analog_frequency_modulator_fc_0
  id: analog_frequency_modulator_fc
  parameters:
    affinity: ''
    alias: ''
    comment: ''
    maxoutbuf: '0'
    minoutbuf: '0'
    sensitivity: math.pi
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [890, 210]
    rotation: 0
    state: enabled
- name: analog_sig_source_x_0
  id: analog_sig_source_x
  parameters:
    affinity: ''
    alias: ''
    comment: ''
    maxoutbuf: '0'
    minoutbuf: '0'
    offset: '0'
    phase: '0'
    samp_rate: samp_rate
    showports: 'False'
    type: float
    waveform: analog.GR_TRI_WAVE
    frequency: '0.05'
    amplitude: '2'
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [10, 190]
    rotation: 0
    state: enabled
- name: blocks_throttle2_0
  id: blocks_throttle2
  parameters:
    affinity: ''
    alias: ''
    comment: ''
    ignoretag: 'True'
    limit: auto
    maximum: '0.1'
    maxoutbuf: '0'
    minoutbuf: '0'
    samples_per_second: samp_rate
    type: float
    vlen: '1'
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [560, 190]
    rotation: 0
    state: enabled
- name: pfb_arb_resampler_xxx_0
  id: pfb_arb_resampler_xxx
  parameters:
    affinity: ''
    alias: ''
    atten: '100'
    comment: ''
    maxoutbuf: '0'
    minoutbuf: '0'
    nfilts: nphases
    rrate: float(new_rate)/samp_rate
    samp_delay: '0'
    taps: rs_taps
    type: ccf
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [1260, 190]
    rotation: 0
    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'
    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: 1,0,1,3
    label: Relative Gain
    label1: Original Spectrum
    label10: ''
    label2: Resampled Spectrum
    label3: ''
    label4: ''
    label5: ''
    label6: ''
    label7: ''
    label8: ''
    label9: ''
    legend: 'False'
    maxoutbuf: '0'
    minoutbuf: '0'
    name: Original 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: '10'
    ymin: '-140'
    samp_rate: samp_rate
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [1260, 330]
    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'
    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: 2,0,1,3
    label: Relative Gain
    label1: Resampled Spectrum
    label10: ''
    label2: Resampled Spectrum
    label3: ''
    label4: ''
    label5: ''
    label6: ''
    label7: ''
    label8: ''
    label9: ''
    legend: 'False'
    maxoutbuf: '0'
    minoutbuf: '0'
    name: Resampled 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: '10'
    ymin: '-140'
    samp_rate: new_rate
  states:
    bus_sink: false
    bus_source: false
    bus_structure: null
    coordinate: [80, 510]
    rotation: 0
    state: enabled
connections:
- [adder, '0', blocks_throttle2_0, '0']
- [analog_frequency_modulator_fc_0, '0', pfb_arb_resampler_xxx_0, '0']
- [analog_frequency_modulator_fc_0, '0', qtgui_freq_sink_x_0, '0']
- [analog_sig_source_x_0, '0', adder, '0']
- [blocks_throttle2_0, '0', analog_frequency_modulator_fc_0, '0']
- [pfb_arb_resampler_xxx_0, '0', qtgui_freq_sink_x_0_0, '0']
metadata:
  file_format: 1
  grc_version: 3.10.10.0