summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-examples/python')
-rw-r--r--gnuradio-examples/python/Makefile.am4
-rw-r--r--gnuradio-examples/python/audio/.gitignore10
-rw-r--r--gnuradio-examples/python/audio/Makefile.am38
-rwxr-xr-xgnuradio-examples/python/audio/audio_copy.py64
-rwxr-xr-xgnuradio-examples/python/audio/audio_fft.py138
-rwxr-xr-xgnuradio-examples/python/audio/audio_play.py57
-rwxr-xr-xgnuradio-examples/python/audio/audio_to_file.py63
-rwxr-xr-xgnuradio-examples/python/audio/dial_tone.py57
-rwxr-xr-xgnuradio-examples/python/audio/dial_tone_daemon.py57
-rwxr-xr-xgnuradio-examples/python/audio/dial_tone_wav.py61
-rwxr-xr-xgnuradio-examples/python/audio/mono_tone.py66
-rwxr-xr-xgnuradio-examples/python/audio/multi_tone.py90
-rwxr-xr-xgnuradio-examples/python/audio/noise.py55
-rwxr-xr-xgnuradio-examples/python/audio/spectrum_inversion.py68
-rwxr-xr-xgnuradio-examples/python/audio/test_resampler.py66
-rwxr-xr-xgnuradio-examples/python/digital/benchmark_qt_loopback2.py25
-rw-r--r--gnuradio-examples/python/digital/simple.py64
-rw-r--r--gnuradio-examples/python/digital/simple_qam.py76
-rw-r--r--gnuradio-examples/python/digital_voice/.gitignore10
-rw-r--r--gnuradio-examples/python/digital_voice/Makefile.am28
-rwxr-xr-xgnuradio-examples/python/digital_voice/cvsd_test.py63
-rwxr-xr-xgnuradio-examples/python/digital_voice/encdec.py58
22 files changed, 162 insertions, 1056 deletions
diff --git a/gnuradio-examples/python/Makefile.am b/gnuradio-examples/python/Makefile.am
index ea03b438f..eba4c14ab 100644
--- a/gnuradio-examples/python/Makefile.am
+++ b/gnuradio-examples/python/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2004,2007,2009 Free Software Foundation, Inc.
+# Copyright 2004,2007,2009,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,10 +23,8 @@ include $(top_srcdir)/Makefile.common
SUBDIRS = \
apps \
- audio \
digital \
digital-bert \
- digital_voice \
mp-sched \
multi-antenna \
multi_usrp \
diff --git a/gnuradio-examples/python/audio/.gitignore b/gnuradio-examples/python/audio/.gitignore
deleted file mode 100644
index c400497f5..000000000
--- a/gnuradio-examples/python/audio/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-/Makefile
-/Makefile.in
-/.la
-/.lo
-/.deps
-/.libs
-/*.la
-/*.lo
-/*.pyc
-/*.pyo
diff --git a/gnuradio-examples/python/audio/Makefile.am b/gnuradio-examples/python/audio/Makefile.am
deleted file mode 100644
index 356b51559..000000000
--- a/gnuradio-examples/python/audio/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright 2004,2009 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.
-#
-
-include $(top_srcdir)/Makefile.common
-
-ourdatadir = $(exampledir)/audio
-
-dist_ourdata_SCRIPTS = \
- audio_copy.py \
- audio_fft.py \
- audio_play.py \
- audio_to_file.py \
- dial_tone.py \
- dial_tone_daemon.py \
- dial_tone_wav.py \
- mono_tone.py \
- multi_tone.py \
- noise.py \
- spectrum_inversion.py \
- test_resampler.py
diff --git a/gnuradio-examples/python/audio/audio_copy.py b/gnuradio-examples/python/audio/audio_copy.py
deleted file mode 100755
index 3094c9f7a..000000000
--- a/gnuradio-examples/python/audio/audio_copy.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007 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.
-#
-
-from gnuradio import gr
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-I", "--audio-input", type="string", default="",
- help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- src = audio.source (sample_rate, options.audio_input)
- dst = audio.sink (sample_rate, options.audio_output)
-
- # Determine the maximum number of outputs on the source and
- # maximum number of inputs on the sink, then connect together
- # the most channels we can without overlap
- nchan = min (src.output_signature().max_streams(),
- dst.input_signature().max_streams())
-
- for i in range (nchan):
- self.connect ((src, i), (dst, i))
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
-
diff --git a/gnuradio-examples/python/audio/audio_fft.py b/gnuradio-examples/python/audio/audio_fft.py
deleted file mode 100755
index 960e0f94d..000000000
--- a/gnuradio-examples/python/audio/audio_fft.py
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007 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.
-#
-
-from gnuradio import gr, gru, audio
-from gnuradio import eng_notation
-from gnuradio.eng_option import eng_option
-from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2, form, slider
-from optparse import OptionParser
-import wx
-import sys
-
-class app_top_block(stdgui2.std_top_block):
- def __init__(self, frame, panel, vbox, argv):
- stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
-
- self.frame = frame
- self.panel = panel
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-W", "--waterfall", action="store_true", default=False,
- help="Enable waterfall display")
- parser.add_option("-S", "--oscilloscope", action="store_true", default=False,
- help="Enable oscilloscope display")
- parser.add_option("-I", "--audio-input", type="string", default="",
- help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
-
- (options, args) = parser.parse_args()
- sample_rate = int(options.sample_rate)
-
- if len(args) != 0:
- parser.print_help()
- sys.exit(1)
-
- self.show_debug_info = True
-
- # build the graph
- if options.waterfall:
- self.scope = \
- waterfallsink2.waterfall_sink_f (panel, fft_size=1024, sample_rate=sample_rate)
- elif options.oscilloscope:
- self.scope = scopesink2.scope_sink_f(panel, sample_rate=sample_rate)
- else:
- self.scope = fftsink2.fft_sink_f (panel, fft_size=1024, sample_rate=sample_rate, fft_rate=30,
- ref_scale=1.0, ref_level=0, y_divs=12)
-
- self.src = audio.source (sample_rate, options.audio_input)
-
- self.connect(self.src, self.scope)
-
- self._build_gui(vbox)
-
- # set initial values
-
- def _set_status_msg(self, msg):
- self.frame.GetStatusBar().SetStatusText(msg, 0)
-
- def _build_gui(self, vbox):
-
- def _form_set_freq(kv):
- return self.set_freq(kv['freq'])
-
- vbox.Add(self.scope.win, 10, wx.EXPAND)
-
- #self._build_subpanel(vbox)
-
- def _build_subpanel(self, vbox_arg):
- # build a secondary information panel (sometimes hidden)
-
- # FIXME figure out how to have this be a subpanel that is always
- # created, but has its visibility controlled by foo.Show(True/False)
-
- def _form_set_decim(kv):
- return self.set_decim(kv['decim'])
-
- if not(self.show_debug_info):
- return
-
- panel = self.panel
- vbox = vbox_arg
- myform = self.myform
-
- #panel = wx.Panel(self.panel, -1)
- #vbox = wx.BoxSizer(wx.VERTICAL)
-
- hbox = wx.BoxSizer(wx.HORIZONTAL)
- hbox.Add((5,0), 0)
-
- myform['decim'] = form.int_field(
- parent=panel, sizer=hbox, label="Decim",
- callback=myform.check_input_and_call(_form_set_decim, self._set_status_msg))
-
- hbox.Add((5,0), 1)
- myform['fs@usb'] = form.static_float_field(
- parent=panel, sizer=hbox, label="Fs@USB")
-
- hbox.Add((5,0), 1)
- myform['dbname'] = form.static_text_field(
- parent=panel, sizer=hbox)
-
- hbox.Add((5,0), 1)
- myform['baseband'] = form.static_float_field(
- parent=panel, sizer=hbox, label="Analog BB")
-
- hbox.Add((5,0), 1)
- myform['ddc'] = form.static_float_field(
- parent=panel, sizer=hbox, label="DDC")
-
- hbox.Add((5,0), 0)
- vbox.Add(hbox, 0, wx.EXPAND)
-
-
-def main ():
- app = stdgui2.stdapp(app_top_block, "Audio FFT", nstatus=1)
- app.MainLoop()
-
-if __name__ == '__main__':
- main ()
diff --git a/gnuradio-examples/python/audio/audio_play.py b/gnuradio-examples/python/audio/audio_play.py
deleted file mode 100755
index f9520c7cf..000000000
--- a/gnuradio-examples/python/audio/audio_play.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007 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.
-#
-
-from gnuradio import gr
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-F", "--filename", type="string", default="audio.dat",
- help="read input from FILE")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- parser.add_option("-R", "--repeat", action="store_true", default=False)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- (options, args) = parser.parse_args()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- src = gr.file_source (gr.sizeof_float, options.filename, options.repeat)
- dst = audio.sink (sample_rate, options.audio_output)
- self.connect(src, dst)
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/audio/audio_to_file.py b/gnuradio-examples/python/audio/audio_to_file.py
deleted file mode 100755
index 0d54f7bd2..000000000
--- a/gnuradio-examples/python/audio/audio_to_file.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2007 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.
-#
-
-from gnuradio import gr
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- usage="%prog: [options] output_filename"
- parser = OptionParser(option_class=eng_option, usage=usage)
- parser.add_option("-I", "--audio-input", type="string", default="",
- help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- parser.add_option("-N", "--nsamples", type="eng_float", default=None,
- help="number of samples to collect [default=+inf]")
-
- (options, args) = parser.parse_args ()
- if len(args) != 1:
- parser.print_help()
- raise SystemExit, 1
- filename = args[0]
-
- sample_rate = int(options.sample_rate)
- src = audio.source (sample_rate, options.audio_input)
- dst = gr.file_sink (gr.sizeof_float, filename)
-
- if options.nsamples is None:
- self.connect((src, 0), dst)
- else:
- head = gr.head(gr.sizeof_float, int(options.nsamples))
- self.connect((src, 0), head, dst)
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/audio/dial_tone.py b/gnuradio-examples/python/audio/dial_tone.py
deleted file mode 100755
index 65c5e50b2..000000000
--- a/gnuradio-examples/python/audio/dial_tone.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007 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.
-#
-
-from gnuradio import gr
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- ampl = 0.1
-
- src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)
- src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl)
- dst = audio.sink (sample_rate, options.audio_output)
- self.connect (src0, (dst, 0))
- self.connect (src1, (dst, 1))
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/audio/dial_tone_daemon.py b/gnuradio-examples/python/audio/dial_tone_daemon.py
deleted file mode 100755
index d30d0e117..000000000
--- a/gnuradio-examples/python/audio/dial_tone_daemon.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007,2008 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.
-#
-
-from gnuradio import gr, gru
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-import os
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- ampl = 0.1
-
- src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)
- src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl)
- dst = audio.sink (sample_rate, options.audio_output)
- self.connect (src0, (dst, 0))
- self.connect (src1, (dst, 1))
-
-
-if __name__ == '__main__':
- pid = gru.daemonize()
- print "To stop this program, enter 'kill %d'" % pid
- my_top_block().run()
diff --git a/gnuradio-examples/python/audio/dial_tone_wav.py b/gnuradio-examples/python/audio/dial_tone_wav.py
deleted file mode 100755
index 6e87b2a48..000000000
--- a/gnuradio-examples/python/audio/dial_tone_wav.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007,2008 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.
-#
-
-# GNU Radio example program to record a dial tone to a WAV file
-
-from gnuradio import gr
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- usage = "%prog: [options] filename"
- parser = OptionParser(option_class=eng_option, usage=usage)
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- parser.add_option("-N", "--samples", type="eng_float", default=None,
- help="number of samples to record")
- (options, args) = parser.parse_args ()
- if len(args) != 1 or options.samples is None:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- ampl = 0.1
-
- src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)
- src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl)
- head0 = gr.head(gr.sizeof_float, int(options.samples))
- head1 = gr.head(gr.sizeof_float, int(options.samples))
- dst = gr.wavfile_sink(args[0], 2, int(options.sample_rate), 16)
-
- self.connect(src0, head0, (dst, 0))
- self.connect(src1, head1, (dst, 1))
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/audio/mono_tone.py b/gnuradio-examples/python/audio/mono_tone.py
deleted file mode 100755
index 869c2e5ff..000000000
--- a/gnuradio-examples/python/audio/mono_tone.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007 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.
-#
-
-from gnuradio import gr
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-#import os
-#print os.getpid()
-#raw_input('Attach gdb and press Enter: ')
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- parser.add_option("-D", "--dont-block", action="store_false", default=True,
- dest="ok_to_block")
-
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- ampl = 0.1
-
- src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 650, ampl)
-
- dst = audio.sink (sample_rate,
- options.audio_output,
- options.ok_to_block)
-
- self.connect (src0, (dst, 0))
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/audio/multi_tone.py b/gnuradio-examples/python/audio/multi_tone.py
deleted file mode 100755
index 7d47dd5d5..000000000
--- a/gnuradio-examples/python/audio/multi_tone.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2006,2007 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.
-#
-
-from gnuradio import gr
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-#import os
-#print os.getpid()
-#raw_input('Attach gdb and press Enter: ')
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- parser.add_option ("-m", "--max-channels", type="int", default="16",
- help="set maximum channels to use")
- parser.add_option("-D", "--dont-block", action="store_false", default=True,
- dest="ok_to_block")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- limit_channels = options.max_channels
-
- ampl = 0.1
-
- # With a tip of the hat to Harry Partch, may he R.I.P.
- # See "Genesis of a Music". He was into some very wild tunings...
- base = 392
- ratios = { 1 : 1.0,
- 3 : 3.0/2,
- 5 : 5.0/4,
- 7 : 7.0/4,
- 9 : 9.0/8,
- 11 : 11.0/8 }
-
- # progression = (1, 5, 3, 7)
- # progression = (1, 9, 3, 7)
- # progression = (3, 7, 9, 11)
- # progression = (7, 11, 1, 5)
- progression = (7, 11, 1, 5, 9)
-
- dst = audio.sink (sample_rate,
- options.audio_output,
- options.ok_to_block)
-
- max_chan = dst.input_signature().max_streams()
- if (max_chan == -1) or (max_chan > limit_channels):
- max_chan = limit_channels
-
- for i in range (max_chan):
- quo, rem = divmod (i, len (progression))
- freq = base * ratios[progression[rem]] * (quo + 1)
- src = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, freq, ampl)
- self.connect (src, (dst, i))
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/audio/noise.py b/gnuradio-examples/python/audio/noise.py
deleted file mode 100755
index 75f741082..000000000
--- a/gnuradio-examples/python/audio/noise.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007 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.
-#
-
-from gnuradio import gr
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- ampl = 0.1
-
- src = gr.glfsr_source_b(32) # Pseudorandom noise source
- b2f = gr.chunks_to_symbols_bf([ampl, -ampl], 1)
- dst = audio.sink(sample_rate, options.audio_output)
- self.connect(src, b2f, dst)
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/audio/spectrum_inversion.py b/gnuradio-examples/python/audio/spectrum_inversion.py
deleted file mode 100755
index 021e23f2d..000000000
--- a/gnuradio-examples/python/audio/spectrum_inversion.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007 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.
-
-#
-# Gang - Here's a simple script that demonstrates spectrum inversion
-# using the multiply by [1,-1] method (mixing with Nyquist frequency).
-# Requires nothing but a sound card, and sounds just like listening
-# to a SSB signal on the wrong sideband.
-#
-
-from gnuradio import gr
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-I", "--audio-input", type="string", default="",
- help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=8000,
- help="set sample rate to RATE (8000)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- src = audio.source (sample_rate, options.audio_input)
- dst = audio.sink (sample_rate, options.audio_output)
-
- vec1 = [1, -1]
- vsource = gr.vector_source_f(vec1, True)
- multiply = gr.multiply_ff()
-
- self.connect(src, (multiply, 0))
- self.connect(vsource, (multiply, 1))
- self.connect(multiply, dst)
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/audio/test_resampler.py b/gnuradio-examples/python/audio/test_resampler.py
deleted file mode 100755
index 4644c5e2f..000000000
--- a/gnuradio-examples/python/audio/test_resampler.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007 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.
-#
-
-from gnuradio import gr, gru, blks2
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-i", "--input-rate", type="eng_float", default=8000,
- help="set input sample rate to RATE (%default)")
- parser.add_option("-o", "--output-rate", type="eng_float", default=48000,
- help="set output sample rate to RATE (%default)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- input_rate = int(options.input_rate)
- output_rate = int(options.output_rate)
-
- interp = gru.lcm(input_rate, output_rate) / input_rate
- decim = gru.lcm(input_rate, output_rate) / output_rate
-
- print "interp =", interp
- print "decim =", decim
-
- ampl = 0.1
- src0 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 650, ampl)
- rr = blks2.rational_resampler_fff(interp, decim)
- dst = audio.sink (output_rate, options.audio_output)
- self.connect (src0, rr, (dst, 0))
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py
index 02ae4b25f..a36f4fbd4 100755
--- a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py
+++ b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py
@@ -20,11 +20,11 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gru, modulation_utils2
+from gnuradio import gr, modulation_utils2
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-import random, time, struct, sys, os, math
+import struct, sys, math
from threading import Thread
@@ -319,6 +319,13 @@ class my_top_block(gr.top_block):
# Connect components
self.connect(self.txpath, self.throttle, self.rxpath)
+ if options.verbose:
+ self._print_verbage()
+
+ if options.log:
+ self._setup_logging()
+
+
# System Parameters
@@ -396,6 +403,15 @@ class my_top_block(gr.top_block):
self.rxpath.packet_receiver._demodulator.freq_recov.set_beta(self._gain_freq/10.0)
#self.rxpath.packet_receiver._demodulator.freq_recov.set_beta(self._gain_fre_beta)
+ def _print_verbage(self):
+ print "\nChannel:"
+ print "SNR: %d" % self.snr()
+ print "Noise voltage: %.2e" % self.get_noise_voltage(self.snr())
+ print "Frequency offset: %.2e" % self.frequency_offset()
+ print "Timing offset: %.2e" % self.timing_offset()
+
+ def _setup_logging(self):
+ pass
# /////////////////////////////////////////////////////////////////////////////
# Thread to handle the packet sending procedure
@@ -466,7 +482,7 @@ def main():
channel_grp = parser.add_option_group("Channel")
parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
- default='dbpsk2',
+ default='psk',
help="Select modulation from: %s [default=%%default]"
% (', '.join(mods.keys()),))
@@ -512,6 +528,7 @@ def main():
tb = my_top_block(mods[options.modulation],
demods[options.modulation],
rx_callback, options)
+
tb.start()
packet_sender = th_send(send_pkt, options.megabytes, options.size)
@@ -527,7 +544,7 @@ def main():
packet_sender.join(1)
except KeyboardInterrupt:
packet_sender.stop()
-
+
if __name__ == '__main__':
try:
diff --git a/gnuradio-examples/python/digital/simple.py b/gnuradio-examples/python/digital/simple.py
new file mode 100644
index 000000000..6d340db36
--- /dev/null
+++ b/gnuradio-examples/python/digital/simple.py
@@ -0,0 +1,64 @@
+
+from gnuradio import gr, blks2, packet_utils
+
+# Some constants
+TX_AMPLITUDE = 0.25
+SAMPLE_RATE = 1e5
+# NOISE_VOLTAGE = 0.01
+NOISE_VOLTAGE = 0.01
+# FREQUENCY_OFFSET = 0
+FREQUENCY_OFFSET = 0.01
+TIMING_OFFSET = 1.0
+SAMPLES_PER_SYMBOL = 2
+GAIN = 1.0
+SW_DECIM = 1
+BAND_MIDPOINT = 1.0
+BAND_WIDTH = 0.5
+
+# Modulation/Demodulation methods
+modulator = blks2.dbpsk2_mod()
+demodulator = blks2.dbpsk2_demod()
+
+#Transmission Blocks
+packet_transmitter = blks2.mod_pkts(modulator, access_code=None, msgq_limit=4,
+ pad_for_usrp=True)
+amp = gr.multiply_const_cc(TX_AMPLITUDE)
+throttle = gr.throttle(gr.sizeof_gr_complex, SAMPLE_RATE)
+# Channel
+channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET)
+# Receiver Blocks
+chan_coeffs = gr.firdes.low_pass(GAIN, SW_DECIM * SAMPLES_PER_SYMBOL,
+ BAND_MIDPOINT, BAND_WIDTH, gr.firdes.WIN_HANN)
+channel_filter = gr.fft_filter_ccc(SW_DECIM, chan_coeffs)
+packet_receiver = blks2.demod_pkts(demodulator, access_code=None, callback=None,
+ threshold=-1)
+# Put it all together and start it up (although nothing will be done
+# until we send some packets).
+tb = gr.top_block()
+tb.connect(packet_transmitter, amp, throttle, channel, channel_filter,
+ packet_receiver)
+tb.start()
+
+# The queue into which recieved packets are placed
+pkq = packet_receiver._rcvd_pktq
+
+# The function to create a packet and place it in a queue to be sent.
+sender = packet_transmitter.send_pkt
+
+# Some some packets (The second will not be recieved because it gets cut off
+# before it can finish. I think this occurs during modulation.)
+sender('hello there I wonder how long this needs to be before I start to see any errors.')
+sender('world')
+sender(eof=True)
+
+# Wait for all the packets to get sent and received.
+tb.wait()
+
+# Check how many messages have been received and print them.
+cnt = pkq.count()
+print('There are %s messages' % cnt)
+for a in range(0, cnt):
+ msg = pkq.delete_head()
+ ok, payload = packet_utils.unmake_packet(msg.to_string(), int(msg.arg1()))
+ print("Message %s is %s" % (a, payload))
+
diff --git a/gnuradio-examples/python/digital/simple_qam.py b/gnuradio-examples/python/digital/simple_qam.py
new file mode 100644
index 000000000..947d7faad
--- /dev/null
+++ b/gnuradio-examples/python/digital/simple_qam.py
@@ -0,0 +1,76 @@
+
+from gnuradio import gr, blks2, packet_utils
+
+# Some constants
+NOISE_VOLTAGE = 0.1
+FREQUENCY_OFFSET = 0.0000
+TIMING_OFFSET = 1.0
+SAMPLES_PER_SYMBOL = 2
+GAIN = 1.0
+SW_DECIM = 1
+BAND_MIDPOINT = 1.0
+BAND_WIDTH = 0.5
+FREQ_ALPHA = 0.005
+EXCESS_BW = 0.35
+
+# Modulation/Demodulation methods
+modulator = blks2.qam_mod(16, SAMPLES_PER_SYMBOL)
+demodulator = blks2.qam_demod(16, SAMPLES_PER_SYMBOL, freq_alpha=FREQ_ALPHA)
+
+#Transmission Blocks
+packet_transmitter = blks2.mod_pkts(modulator, access_code=None, msgq_limit=4,
+ pad_for_usrp=True)
+# Channel
+channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET)
+# Receiver Blocks
+chan_coeffs = gr.firdes.low_pass(GAIN, SW_DECIM * SAMPLES_PER_SYMBOL,
+ BAND_MIDPOINT, BAND_WIDTH, gr.firdes.WIN_HANN)
+channel_filter = gr.fft_filter_ccc(SW_DECIM, chan_coeffs)
+packet_receiver = blks2.demod_pkts(demodulator, access_code=None, callback=None,
+ threshold=-1)
+# Put it all together and start it up (although nothing will be done
+# until we send some packets).
+tb = gr.top_block()
+tb.connect(packet_transmitter, channel, channel_filter,
+ packet_receiver)
+tb.start()
+
+# The queue into which recieved packets are placed
+pkq = packet_receiver._rcvd_pktq
+
+# The function to create a packet and place it in a queue to be sent.
+sender = packet_transmitter.send_pkt
+
+# Some some packets (The second will not be recieved because it gets cut off
+# before it can finish. I think this occurs during modulation.)
+
+# Send some large messages to start off with to let things lock.
+for i in range(0, int(20.0/SAMPLES_PER_SYMBOL)):
+ sender('a'*4000)
+
+sender('hello1')
+sender('hello2')
+sender('hello3')
+sender('hello4')
+sender('hello5')
+sender('hello6')
+sender('hello7')
+sender('hello8')
+sender('hello9')
+sender('hello10')
+sender('hello11')
+sender('hello12')
+sender('world')
+sender(eof=True)
+
+# Wait for all the packets to get sent and received.
+tb.wait()
+
+# Check how many messages have been received and print them.
+cnt = pkq.count()
+print('There are %s messages' % cnt)
+for a in range(0, cnt):
+ msg = pkq.delete_head()
+ ok, payload = packet_utils.unmake_packet(msg.to_string(), int(msg.arg1()))
+ print("Message %s is %s" % (a, payload))
+
diff --git a/gnuradio-examples/python/digital_voice/.gitignore b/gnuradio-examples/python/digital_voice/.gitignore
deleted file mode 100644
index c400497f5..000000000
--- a/gnuradio-examples/python/digital_voice/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-/Makefile
-/Makefile.in
-/.la
-/.lo
-/.deps
-/.libs
-/*.la
-/*.lo
-/*.pyc
-/*.pyo
diff --git a/gnuradio-examples/python/digital_voice/Makefile.am b/gnuradio-examples/python/digital_voice/Makefile.am
deleted file mode 100644
index 60f363b90..000000000
--- a/gnuradio-examples/python/digital_voice/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright 2004,2005,2009 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.
-#
-
-include $(top_srcdir)/Makefile.common
-
-ourdatadir = $(exampledir)/digital_voice
-
-dist_ourdata_SCRIPTS = \
- encdec.py \
- cvsd_test.py
diff --git a/gnuradio-examples/python/digital_voice/cvsd_test.py b/gnuradio-examples/python/digital_voice/cvsd_test.py
deleted file mode 100755
index f8f1b9cce..000000000
--- a/gnuradio-examples/python/digital_voice/cvsd_test.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007 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.
-#
-
-from gnuradio import gr, blks2
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-def main():
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-I", "--audio-input", type="string", default="",
- help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default="32000",
- help="Audio sampling rate [defaul=%default]")
- parser.add_option("-S", "--resample-rate", type="int", default="8",
- help="Resampling rate in CVSD [default=%default]")
- (options, args) = parser.parse_args ()
-
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- tb = gr.top_block()
-
- src = audio.source(int(options.sample_rate), options.audio_input)
- tx = blks2.cvsd_encode(options.resample_rate)
-
- # todo: add noise
-
- rx = blks2.cvsd_decode(options.resample_rate)
- dst = audio.sink(int(options.sample_rate), options.audio_output)
-
- tb.connect(src, tx, rx, dst)
- tb.run()
-
-if __name__ == '__main__':
- print "Enter CTRL-C to exit"
- try:
- main()
- except KeyboardInterrupt:
- pass
-
diff --git a/gnuradio-examples/python/digital_voice/encdec.py b/gnuradio-examples/python/digital_voice/encdec.py
deleted file mode 100755
index e87d57e2b..000000000
--- a/gnuradio-examples/python/digital_voice/encdec.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2005 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.
-#
-
-from gnuradio import gr, blks2
-from gnuradio import audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-I", "--audio-input", type="string", default="",
- help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = 8000
- src = audio.source(sample_rate, options.audio_input)
- tx = blks2.digital_voice_tx(self)
- if_gain = gr.multiply_const_cc(10000)
- # channel simulator here...
- rx = blks2.digital_voice_rx(self)
- dst = audio.sink(sample_rate, options.audio_output)
-
- self.connect(src, tx, if_gain, rx, dst)
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass