From 7dc08ba2875c0dace0432cd514add6ce2b085f44 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 3 Apr 2012 11:35:35 -0400 Subject: examples: Reworked locations and installation of examples. All python and GRC examples directly associated with a top-level component are now in that examples directory. Examples are split into c++, python, and grc dirs but are all installed into $prefix/share/gnuradio/examples/. --- gr-audio/CMakeLists.txt | 12 +- gr-audio/examples/c++/CMakeLists.txt | 6 + gr-audio/examples/grc/CMakeLists.txt | 27 + gr-audio/examples/grc/cvsd_sweep.grc | 918 ++++++++++++++++++++++++++++++++ gr-audio/examples/grc/dial_tone.grc | 375 +++++++++++++ gr-audio/examples/python/CMakeLists.txt | 2 +- 6 files changed, 1338 insertions(+), 2 deletions(-) create mode 100644 gr-audio/examples/grc/CMakeLists.txt create mode 100644 gr-audio/examples/grc/cvsd_sweep.grc create mode 100644 gr-audio/examples/grc/dial_tone.grc (limited to 'gr-audio') diff --git a/gr-audio/CMakeLists.txt b/gr-audio/CMakeLists.txt index 7038b9b0f..f9975cf08 100644 --- a/gr-audio/CMakeLists.txt +++ b/gr-audio/CMakeLists.txt @@ -33,6 +33,8 @@ GR_REGISTER_COMPONENT("gr-audio" ENABLE_GR_AUDIO GR_SET_GLOBAL(GR_AUDIO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) +SET(GR_PKG_AUDIO_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/audio) + ######################################################################## # Begin conditional configuration ######################################################################## @@ -65,6 +67,13 @@ CPACK_COMPONENT("audio_python" DEPENDS "core_python;audio_runtime" ) +CPACK_COMPONENT("audio_examples" + GROUP "Audio" + DISPLAY_NAME "Examples" + DESCRIPTION "Example programs" + DEPENDS "audio_runtime" +) + CPACK_COMPONENT("audio_swig" GROUP "Audio" DISPLAY_NAME "SWIG" @@ -77,12 +86,13 @@ CPACK_COMPONENT("audio_swig" ######################################################################## add_subdirectory(include) add_subdirectory(lib) -add_subdirectory(examples/c++) add_subdirectory(doc) +add_subdirectory(examples/c++) if(ENABLE_PYTHON) add_subdirectory(swig) add_subdirectory(grc) add_subdirectory(examples/python) + add_subdirectory(examples/grc) endif(ENABLE_PYTHON) ######################################################################## diff --git a/gr-audio/examples/c++/CMakeLists.txt b/gr-audio/examples/c++/CMakeLists.txt index 38490cce8..28bbc52a5 100644 --- a/gr-audio/examples/c++/CMakeLists.txt +++ b/gr-audio/examples/c++/CMakeLists.txt @@ -21,3 +21,9 @@ include_directories(${GR_AUDIO_INCLUDE_DIRS}) include_directories(${GNURADIO_CORE_INCLUDE_DIRS}) add_executable(dial_tone dial_tone.cc) target_link_libraries(dial_tone gnuradio-audio) + +INSTALL(TARGETS + dial_tone + DESTINATION ${GR_PKG_AUDIO_EXAMPLES_DIR} + COMPONENT "audio_examples" +) diff --git a/gr-audio/examples/grc/CMakeLists.txt b/gr-audio/examples/grc/CMakeLists.txt new file mode 100644 index 000000000..179b42fcc --- /dev/null +++ b/gr-audio/examples/grc/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright 2012 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +install( + FILES + cvsd_sweep.grc + dial_tone.grc + DESTINATION ${GR_PKG_AUDIO_EXAMPLES_DIR} + COMPONENT "audio_python" +) + diff --git a/gr-audio/examples/grc/cvsd_sweep.grc b/gr-audio/examples/grc/cvsd_sweep.grc new file mode 100644 index 000000000..b645b747a --- /dev/null +++ b/gr-audio/examples/grc/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 + + + + vocoder_cvsd_decode_bf + + id + vocoder_cvsd_decode_bf_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 + + + + vocoder_cvsd_encode_fb + + 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 + vocoder_cvsd_decode_bf_0 + 0 + 0 + + + vco + orig_scope + 0 + 0 + + + vocoder_cvsd_decode_bf_0 + dec_fft + 0 + 0 + + + vocoder_cvsd_decode_bf_0 + dec_scope + 0 + 0 + + + vocoder_cvsd_decode_bf_0 + audio_sink + 0 + 0 + + + enc + p2u + 0 + 0 + + + p2u + c2f + 0 + 0 + + + c2f + enc_fft + 0 + 0 + + + c2f + enc_scope + 0 + 0 + + diff --git a/gr-audio/examples/grc/dial_tone.grc b/gr-audio/examples/grc/dial_tone.grc new file mode 100644 index 000000000..ac8cbef27 --- /dev/null +++ b/gr-audio/examples/grc/dial_tone.grc @@ -0,0 +1,375 @@ + + + Thu Jul 24 14:27:48 2008 + + options + + id + dial_tone + + + _enabled + True + + + title + Dial Tone + + + author + Example + + + description + example flow graph + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + gr_add_xx + + id + gr_add_xx + + + _enabled + True + + + type + float + + + num_inputs + 3 + + + vlen + 1 + + + _coordinate + (513, 277) + + + _rotation + 0 + + + + audio_sink + + id + audio_sink + + + _enabled + True + + + samp_rate + 32000 + + + device_name + + + + ok_to_block + True + + + num_inputs + 1 + + + _coordinate + (699, 112) + + + _rotation + 0 + + + + gr_noise_source_x + + id + gr_noise_source_x + + + _enabled + True + + + type + float + + + noise_type + gr.GR_GAUSSIAN + + + amp + noise + + + seed + 42 + + + _coordinate + (238, 380) + + + _rotation + 0 + + + + gr_sig_source_x + + id + gr_sig_source_x + + + _enabled + True + + + type + float + + + samp_rate + samp_rate + + + waveform + gr.GR_COS_WAVE + + + freq + 440 + + + amp + ampl + + + offset + 0 + + + _coordinate + (240, 208) + + + _rotation + 0 + + + + gr_sig_source_x + + id + gr_sig_source_x0 + + + _enabled + True + + + type + float + + + samp_rate + samp_rate + + + waveform + gr.GR_COS_WAVE + + + freq + 350 + + + amp + ampl + + + offset + 0 + + + _coordinate + (240, 38) + + + _rotation + 0 + + + + variable_slider + + id + ampl + + + _enabled + True + + + label + Volume + + + value + .4 + + + min + 0 + + + max + .5 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 0, 0, 1, 2 + + + _coordinate + (634, 413) + + + _rotation + 0 + + + + variable_slider + + id + noise + + + _enabled + True + + + label + Noise + + + value + .005 + + + min + 0 + + + max + .2 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 1, 0, 1, 2 + + + _coordinate + (443, 412) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 32000 + + + _coordinate + (11, 171) + + + _rotation + 0 + + + + gr_sig_source_x0 + gr_add_xx + 0 + 0 + + + gr_sig_source_x + gr_add_xx + 0 + 1 + + + gr_noise_source_x + gr_add_xx + 0 + 2 + + + gr_add_xx + audio_sink + 0 + 0 + + diff --git a/gr-audio/examples/python/CMakeLists.txt b/gr-audio/examples/python/CMakeLists.txt index 86ba86ac0..24e29e234 100644 --- a/gr-audio/examples/python/CMakeLists.txt +++ b/gr-audio/examples/python/CMakeLists.txt @@ -32,6 +32,6 @@ GR_PYTHON_INSTALL(PROGRAMS noise.py spectrum_inversion.py test_resampler.py - DESTINATION ${GR_PKG_DATA_DIR}/examples/audio + DESTINATION ${GR_PKG_AUDIO_EXAMPLES_DIR} COMPONENT "audio_python" ) -- cgit