From 7d8dd5e122e0201d96410eec6549b903881f8b3a Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 19 Sep 2009 20:38:24 -0700 Subject: [PATCH] Added CVSD encoder/decoder to GRC, example app Used blks2.cvsd* wrappers, not bare gnuradio.vocoder.cvsd* Example application sweeps 0-4KHz through encoder/decoder pair configured as Bluetooth standard --- grc/blocks/Makefile.am | 2 + grc/blocks/blks2_cvsd_decode.xml | 32 ++ grc/blocks/blks2_cvsd_encode.xml | 32 ++ grc/blocks/block_tree.xml | 5 + grc/examples/Makefile.am | 3 +- grc/examples/audio/cvsd_sweep.grc | 918 ++++++++++++++++++++++++++++++ 6 files changed, 991 insertions(+), 1 deletion(-) create mode 100644 grc/blocks/blks2_cvsd_decode.xml create mode 100644 grc/blocks/blks2_cvsd_encode.xml create mode 100644 grc/examples/audio/cvsd_sweep.grc diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am index 32ddc656..617a3bf6 100644 --- a/grc/blocks/Makefile.am +++ b/grc/blocks/Makefile.am @@ -30,6 +30,8 @@ dist_ourdata_DATA = \ band_reject_filter.xml \ blks2_am_demod_cf.xml \ blks2_analysis_filterbank.xml \ + blks2_cvsd_encode.xml \ + blks2_cvsd_decode.xml \ blks2_dxpsk_demod.xml \ blks2_dxpsk_mod.xml \ blks2_error_rate.xml \ diff --git a/grc/blocks/blks2_cvsd_decode.xml b/grc/blocks/blks2_cvsd_decode.xml new file mode 100644 index 00000000..6be7daa2 --- /dev/null +++ b/grc/blocks/blks2_cvsd_decode.xml @@ -0,0 +1,32 @@ + + + + CVSD Decoder + blks2_cvsd_decode + from gnuradio import blks2 + blks2.cvsd_decode($resample,$bw) + + Resample + resample + 8 + int + + + Frac. Bandwidth + bw + 0.5 + real + + + in + byte + + + out + float + + diff --git a/grc/blocks/blks2_cvsd_encode.xml b/grc/blocks/blks2_cvsd_encode.xml new file mode 100644 index 00000000..3123b1aa --- /dev/null +++ b/grc/blocks/blks2_cvsd_encode.xml @@ -0,0 +1,32 @@ + + + + CVSD Encoder + blks2_cvsd_encode + from gnuradio import blks2 + blks2.cvsd_encode($resample,$bw) + + Resample + resample + 8 + int + + + Frac. Bandwidth + bw + 0.5 + real + + + in + float + + + out + byte + + diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 5a989cc0..296f0ee9 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -251,6 +251,11 @@ gr_scrambler_bb gr_descrambler_bb + + Vocoders + blks2_cvsd_encode + blks2_cvsd_decode + Probes gr_probe_avg_mag_sqrd_x diff --git a/grc/examples/Makefile.am b/grc/examples/Makefile.am index 969485c0..78321ce0 100644 --- a/grc/examples/Makefile.am +++ b/grc/examples/Makefile.am @@ -25,7 +25,8 @@ grc_examples_prefix = $(exampledir)/grc audiodatadir = $(grc_examples_prefix)/audio dist_audiodata_DATA = \ - audio/dial_tone.grc + audio/dial_tone.grc \ + audio/cvsd_sweep.grc simpledatadir = $(grc_examples_prefix)/simple dist_simpledata_DATA = \ diff --git a/grc/examples/audio/cvsd_sweep.grc b/grc/examples/audio/cvsd_sweep.grc new file mode 100644 index 00000000..8d0b385c --- /dev/null +++ b/grc/examples/audio/cvsd_sweep.grc @@ -0,0 +1,918 @@ + + + Sat Sep 19 20:30:08 2009 + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (157, 11) + + + _rotation + 0 + + + + blks2_cvsd_decode + + id + blks2_cvsd_decode_0 + + + _enabled + True + + + resample + resample + + + bw + bw + + + _coordinate + (887, 340) + + + _rotation + 0 + + + + gr_sig_source_x + + id + tri_source + + + _enabled + True + + + type + float + + + samp_rate + audio_rate + + + waveform + gr.GR_TRI_WAVE + + + freq + 0.05 + + + amp + 0.5 + + + offset + 0 + + + _coordinate + (44, 316) + + + _rotation + 0 + + + + gr_throttle + + id + throttle + + + _enabled + True + + + type + float + + + samples_per_second + audio_rate + + + vlen + 1 + + + _coordinate + (238, 348) + + + _rotation + 0 + + + + gr_vco_f + + id + vco + + + _enabled + True + + + samp_rate + audio_rate + + + sensitivity + audio_rate*2*math.pi + + + amplitude + 0.9 + + + _coordinate + (427, 332) + + + _rotation + 0 + + + + blks2_cvsd_encode + + id + enc + + + _enabled + True + + + resample + resample + + + bw + bw + + + _coordinate + (655, 340) + + + _rotation + 0 + + + + gr_packed_to_unpacked_xx + + id + p2u + + + _enabled + True + + + type + byte + + + bits_per_chunk + 1 + + + endianness + gr.GR_MSB_FIRST + + + _coordinate + (648, 415) + + + _rotation + 180 + + + + gr_char_to_float + + id + c2f + + + _enabled + True + + + _coordinate + (676, 483) + + + _rotation + 0 + + + + audio_sink + + id + audio_sink + + + _enabled + True + + + samp_rate + audio_rate + + + device_name + plughw:0,0 + + + ok_to_block + True + + + num_inputs + 1 + + + _coordinate + (1127, 340) + + + _rotation + 0 + + + + variable + + id + audio_rate + + + _enabled + True + + + value + 8000 + + + _coordinate + (251, 10) + + + _rotation + 0 + + + + variable + + id + resample + + + _enabled + True + + + value + 8 + + + _coordinate + (344, 11) + + + _rotation + 0 + + + + variable + + id + bw + + + _enabled + True + + + value + 0.5 + + + _coordinate + (431, 11) + + + _rotation + 0 + + + + notebook + + id + displays + + + _enabled + True + + + style + wx.NB_TOP + + + labels + ['Original','Encoded','Decoded'] + + + grid_pos + + + + notebook + + + + _coordinate + (12, 106) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + orig_fft + + + _enabled + True + + + type + float + + + title + Original Spectrum + + + samp_rate + audio_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + 0 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (415, 97) + + + _rotation + 180 + + + + wxgui_scopesink2 + + id + orig_scope + + + _enabled + True + + + type + float + + + title + Original Waveform + + + samp_rate + audio_rate + + + v_scale + 0 + + + t_scale + 0 + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 0 + + + _coordinate + (414, 425) + + + _rotation + 180 + + + + wxgui_fftsink2 + + id + enc_fft + + + _enabled + True + + + type + float + + + title + Encoded Spectrum + + + samp_rate + audio_rate*resample + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 8 + + + ref_level + 10 + + + ref_scale + 2.0 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (610, 551) + + + _rotation + 180 + + + + wxgui_scopesink2 + + id + enc_scope + + + _enabled + True + + + type + float + + + title + Encoded Waveform + + + samp_rate + audio_rate*resample + + + v_scale + 0.5 + + + t_scale + 20.0/(audio_rate*resample) + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 1 + + + _coordinate + (858, 591) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + dec_fft + + + _enabled + True + + + type + float + + + title + Decoded Spectrum + + + samp_rate + audio_rate + + + baseband_freq + 0 + + + y_per_div + 5 + + + y_divs + 10 + + + ref_level + 10 + + + ref_scale + 0.1 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + grid_pos + 0, 0, 1, 1 + + + notebook + displays, 2 + + + _coordinate + (891, 98) + + + _rotation + 180 + + + + wxgui_scopesink2 + + id + dec_scope + + + _enabled + True + + + type + float + + + title + Decoded Waveform + + + samp_rate + audio_rate + + + v_scale + 0 + + + t_scale + 0 + + + ac_couple + False + + + xy_mode + False + + + num_inputs + 1 + + + grid_pos + 1, 0, 1, 1 + + + notebook + displays, 2 + + + _coordinate + (889, 422) + + + _rotation + 180 + + + + options + + id + cvsd_sweep + + + _enabled + True + + + title + CVSD Vocoder Test + + + author + + + + description + + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + vco + orig_fft + 0 + 0 + + + tri_source + throttle + 0 + 0 + + + throttle + vco + 0 + 0 + + + vco + enc + 0 + 0 + + + enc + blks2_cvsd_decode_0 + 0 + 0 + + + vco + orig_scope + 0 + 0 + + + blks2_cvsd_decode_0 + dec_fft + 0 + 0 + + + blks2_cvsd_decode_0 + dec_scope + 0 + 0 + + + blks2_cvsd_decode_0 + audio_sink + 0 + 0 + + + enc + p2u + 0 + 0 + + + p2u + c2f + 0 + 0 + + + c2f + enc_fft + 0 + 0 + + + c2f + enc_scope + 0 + 0 + + -- 2.30.2