summaryrefslogtreecommitdiff
path: root/gr-cvsd-vocoder/src/python
diff options
context:
space:
mode:
Diffstat (limited to 'gr-cvsd-vocoder/src/python')
-rw-r--r--gr-cvsd-vocoder/src/python/.gitignore3
-rw-r--r--gr-cvsd-vocoder/src/python/Makefile.am36
-rw-r--r--gr-cvsd-vocoder/src/python/cvsd.py87
-rwxr-xr-xgr-cvsd-vocoder/src/python/encdec.py69
-rwxr-xr-xgr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py115
-rw-r--r--gr-cvsd-vocoder/src/python/run_tests.in10
6 files changed, 0 insertions, 320 deletions
diff --git a/gr-cvsd-vocoder/src/python/.gitignore b/gr-cvsd-vocoder/src/python/.gitignore
deleted file mode 100644
index 604b402c5..000000000
--- a/gr-cvsd-vocoder/src/python/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile
-/Makefile.in
-/run_tests
diff --git a/gr-cvsd-vocoder/src/python/Makefile.am b/gr-cvsd-vocoder/src/python/Makefile.am
deleted file mode 100644
index e6fd74828..000000000
--- a/gr-cvsd-vocoder/src/python/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Copyright 2004,2009,2010 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
-
-EXTRA_DIST += run_tests.in
-DISTCLEANFILES += run_tests
-TESTS = run_tests
-
-
-grblkspythondir = $(grpythondir)/blks2impl
-
-grblkspython_PYTHON = \
- cvsd.py
-
-noinst_PYTHON = \
- encdec.py \
- qa_cvsd_vocoder.py
diff --git a/gr-cvsd-vocoder/src/python/cvsd.py b/gr-cvsd-vocoder/src/python/cvsd.py
deleted file mode 100644
index 4defbf9a2..000000000
--- a/gr-cvsd-vocoder/src/python/cvsd.py
+++ /dev/null
@@ -1,87 +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.vocoder import cvsd_vocoder
-
-class cvsd_encode(gr.hier_block2):
- '''
- This is a wrapper for the CVSD encoder that performs interpolation and filtering
- necessary to work with the vocoding. It converts an incoming float (+-1) to a short, scales
- it (to 32000; slightly below the maximum value), interpolates it, and then vocodes it.
-
- The incoming sampling rate can be anything, though, of course, the higher the sampling rate and the
- higher the interpolation rate are, the better the sound quality.
- '''
-
- def __init__(self, resample=8, bw=0.5):
- '''
- When using the CVSD vocoder, appropriate sampling rates are from 8k to 64k with resampling rates
- from 1 to 8. A rate of 8k with a resampling rate of 8 provides a good quality signal.
- '''
-
- gr.hier_block2.__init__(self, "cvsd_encode",
- gr.io_signature(1, 1, gr.sizeof_float), # Input signature
- gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
-
- scale_factor = 32000.0
- self.interp = resample
-
- src_scale = gr.multiply_const_ff(scale_factor)
- taps = gr.firdes.low_pass(self.interp, self.interp, bw, 2*bw)
- interp = gr.interp_fir_filter_fff(self.interp, taps)
- f2s = gr.float_to_short()
- enc = cvsd_vocoder.encode_sb()
-
- self.connect(self, src_scale, interp, f2s, enc, self)
-
-
-class cvsd_decode(gr.hier_block2):
- '''
- This is a wrapper for the CVSD decoder that performs decimation and filtering
- necessary to work with the vocoding. It converts an incoming CVSD-encoded short to a float, decodes it
- to a float, decimates it, and scales it (by 32000; slightly below the maximum value to avoid clipping).
-
- The sampling rate can be anything, though, of course, the higher the sampling rate and the
- higher the interpolation rate are, the better the sound quality.
- '''
-
- def __init__(self, resample=8, bw=0.5):
- '''
- When using the CVSD vocoder, appropriate sampling rates are from 8k to 64k with resampling rates
- from 1 to 8. A rate of 8k with a resampling rate of 8 provides a good quality signal.
- '''
- gr.hier_block2.__init__(self, "cvsd_decode",
- gr.io_signature(1, 1, gr.sizeof_char), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
-
- scale_factor = 32000.0
- self.decim = resample
-
- dec = cvsd_vocoder.decode_bs()
- s2f = gr.short_to_float()
- taps = gr.firdes.low_pass(1, 1, bw, 2*bw)
- decim = gr.fir_filter_fff(self.decim, taps)
- sink_scale = gr.multiply_const_ff(1.0/scale_factor)
-
- self.connect(self, dec, s2f, decim, sink_scale, self)
-
diff --git a/gr-cvsd-vocoder/src/python/encdec.py b/gr-cvsd-vocoder/src/python/encdec.py
deleted file mode 100755
index 34c153b06..000000000
--- a/gr-cvsd-vocoder/src/python/encdec.py
+++ /dev/null
@@ -1,69 +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.vocoder import cvsd_vocoder
-
-def build_graph():
- sample_rate = 8000
- scale_factor = 32000
-
- tb = gr.top_block()
- src = audio.source(sample_rate, "plughw:0,0")
- src_scale = gr.multiply_const_ff(scale_factor)
-
- interp = blks2.rational_resampler_fff(8, 1)
- f2s = gr.float_to_short ()
-
- enc = cvsd_vocoder.encode_sb()
- dec = cvsd_vocoder.decode_bs()
-
- s2f = gr.short_to_float ()
- decim = blks2.rational_resampler_fff(1, 8)
-
- sink_scale = gr.multiply_const_ff(1.0/scale_factor)
- sink = audio.sink(sample_rate, "plughw:0,0")
-
- tb.connect(src, src_scale, interp, f2s, enc)
- tb.connect(enc, dec, s2f, decim, sink_scale, sink)
-
- if 0: # debug
- tb.conect(src, gr.file_sink(gr.sizeof_float, "source.dat"))
- tb.conect(src_scale, gr.file_sink(gr.sizeof_float, "src_scale.dat"))
- tb.conect(interp, gr.file_sink(gr.sizeof_float, "interp.dat"))
- tb.conect(f2s, gr.file_sink(gr.sizeof_short, "f2s.dat"))
- tb.conect(enc, gr.file_sink(gr.sizeof_char, "enc.dat"))
- tb.conect(dec, gr.file_sink(gr.sizeof_short, "dec.dat"))
- tb.conect(s2f, gr.file_sink(gr.sizeof_float, "s2f.dat"))
- tb.conect(decim, gr.file_sink(gr.sizeof_float, "decim.dat"))
- tb.conect(sink_scale, gr.file_sink(gr.sizeof_float, "sink_scale.dat"))
-
- return tb
-
-if __name__ == '__main__':
- tb = build_graph()
- print "Enter CTRL-C to stop"
- try:
- tb.run()
- except KeyboardInterrupt:
- pass
diff --git a/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py b/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py
deleted file mode 100755
index 99a38d946..000000000
--- a/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007,2010 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, gr_unittest, blks2
-import cvsd_vocoder
-
-class test_cvsd_vocoder (gr_unittest.TestCase):
-
- def setUp (self):
- self.tb = gr.top_block()
-
- def tearDown (self):
- self.tb = None
-
- """ Disable for now
- def test01(self):
- sample_rate = 8000
- scale_factor = 32000
-
- expected_data = (6.9670547250243192e-21, -2.4088578356895596e-05,
- -5.1261918997624889e-05, 7.2410854045301676e-05,
- 8.444241393590346e-05, -1.2537107068055775e-05,
- 0.00024186755763366818, -0.00060463894624263048,
- 0.00064864184241741896, 0.010409165173768997,
- 0.0087582804262638092, 0.017965050414204597,
- 0.010722399689257145, 0.006602009292691946,
- 0.02213001623749733, 0.0079685859382152557,
- 0.033707316964864731, 0.027021972462534904,
- 0.0086071854457259178, 0.0081678871065378189,
- 0.039343506097793579, 0.030671956017613411,
- 0.029626710340380669, 0.020126519724726677,
- 0.023636780679225922, 0.0064640454947948456,
- -0.0038861562497913837, 0.0021134600974619389,
- -0.0088051930069923401, -0.00023228264763019979,
- -0.033737499266862869, -0.033141419291496277,
- -0.037145044654607773, -0.0080892946571111679,
- -0.077117636799812317, -0.078382067382335663,
- -0.055503919720649719, -0.019355267286300659,
- -0.022441385313868523, -0.073706060647964478,
- -0.054677654057741165, -0.047119375318288803,
- -0.044418536126613617, -0.036084383726119995,
- -0.0206278245896101, -0.031200021505355835,
- -0.0004070434661116451, 0.0006594572332687676,
- -0.016584658995270729, 0.07387717068195343,
- -0.0063191778026521206, 0.051200628280639648,
- -0.029480356723070145, 0.05176771804690361,
- 0.038578659296035767, 0.026550088077783585,
- 0.067103870213031769, 0.001888439292088151,
- 0.28141644597053528, 0.49543789029121399,
- 0.6626054048538208, 0.79180729389190674,
- 0.89210402965545654, 0.96999943256378174,
- 1.0261462926864624, 1.0267977714538574,
- 1.0251555442810059, 1.0265737771987915,
- 1.0278496742248535, 1.0208886861801147,
- 1.0325057506561279, 0.91415292024612427,
- 0.83941859006881714, 0.67373806238174438,
- 0.51683622598648071, 0.38949671387672424,
- 0.16016888618469238, 0.049505095928907394,
- -0.16699212789535522, -0.26886492967605591,
- -0.49256673455238342, -0.59178370237350464,
- -0.73317724466323853, -0.78922677040100098,
- -0.88782668113708496, -0.96708977222442627,
- -0.96490746736526489, -0.94962418079376221,
- -0.94716215133666992, -0.93755108118057251,
- -0.84852480888366699, -0.80485564470291138,
- -0.69762390851974487, -0.58398681879043579,
- -0.45891636610031128, -0.29681697487831116,
- -0.16035343706607819, 0.014823081903159618,
- 0.16282452642917633, 0.33802291750907898)
-
- src = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, 200, 1, 0)
- head = gr.head(gr.sizeof_float, 100)
- src_scale = gr.multiply_const_ff(scale_factor)
-
- interp = blks2.rational_resampler_fff(8, 1)
- f2s = gr.float_to_short ()
-
- enc = cvsd_vocoder.encode_sb()
- dec = cvsd_vocoder.decode_bs()
-
- s2f = gr.short_to_float ()
- decim = blks2.rational_resampler_fff(1, 8)
-
- sink_scale = gr.multiply_const_ff(1.0/scale_factor)
- sink = gr.vector_sink_f()
-
- self.tb.connect(src, src_scale, interp, f2s, enc)
- self.tb.connect(enc, dec, s2f, decim, sink_scale, head, sink)
- self.tb.run()
- print sink.data()
-
- self.assertFloatTuplesAlmostEqual (expected_data, sink.data(), 5)
- """
-
-if __name__ == '__main__':
- gr_unittest.run(test_cvsd_vocoder, "test_cvsd_vocoder.xml")
diff --git a/gr-cvsd-vocoder/src/python/run_tests.in b/gr-cvsd-vocoder/src/python/run_tests.in
deleted file mode 100644
index be969e287..000000000
--- a/gr-cvsd-vocoder/src/python/run_tests.in
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-# 1st parameter is absolute path to component source directory
-# 2nd parameter is absolute path to component build directory
-# 3rd parameter is path to Python QA directory
-
-@top_builddir@/run_tests.sh \
- @abs_top_srcdir@/gr-cvsd-vocoder \
- @abs_top_builddir@/gr-cvsd-vocoder \
- @srcdir@