summaryrefslogtreecommitdiff
path: root/gr-cvsd-vocoder/src
diff options
context:
space:
mode:
Diffstat (limited to 'gr-cvsd-vocoder/src')
-rw-r--r--gr-cvsd-vocoder/src/.gitignore2
-rw-r--r--gr-cvsd-vocoder/src/Makefile.am25
-rw-r--r--gr-cvsd-vocoder/src/lib/.gitignore9
-rw-r--r--gr-cvsd-vocoder/src/lib/Makefile.am58
-rw-r--r--gr-cvsd-vocoder/src/lib/Makefile.swig.gen145
-rw-r--r--gr-cvsd-vocoder/src/lib/cvsd_decode_bs.cc193
-rw-r--r--gr-cvsd-vocoder/src/lib/cvsd_decode_bs.h170
-rw-r--r--gr-cvsd-vocoder/src/lib/cvsd_encode_sb.cc191
-rw-r--r--gr-cvsd-vocoder/src/lib/cvsd_encode_sb.h173
-rw-r--r--gr-cvsd-vocoder/src/lib/cvsd_vocoder.i91
-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
16 files changed, 0 insertions, 1377 deletions
diff --git a/gr-cvsd-vocoder/src/.gitignore b/gr-cvsd-vocoder/src/.gitignore
deleted file mode 100644
index b336cc7ce..000000000
--- a/gr-cvsd-vocoder/src/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/Makefile
-/Makefile.in
diff --git a/gr-cvsd-vocoder/src/Makefile.am b/gr-cvsd-vocoder/src/Makefile.am
deleted file mode 100644
index be38b7c1a..000000000
--- a/gr-cvsd-vocoder/src/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Copyright 2004 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.
-#
-
-SUBDIRS = lib
-if PYTHON
-SUBDIRS += python
-endif
diff --git a/gr-cvsd-vocoder/src/lib/.gitignore b/gr-cvsd-vocoder/src/lib/.gitignore
deleted file mode 100644
index ea0a01678..000000000
--- a/gr-cvsd-vocoder/src/lib/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-/Makefile
-/Makefile.in
-/.libs
-/.deps
-/cvsd_vocoder.cc
-/cvsd_vocoder.py*
-/gnuradio
-/guile
-/python
diff --git a/gr-cvsd-vocoder/src/lib/Makefile.am b/gr-cvsd-vocoder/src/lib/Makefile.am
deleted file mode 100644
index 9c8c96b96..000000000
--- a/gr-cvsd-vocoder/src/lib/Makefile.am
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# Copyright 2004,2005,2008,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
-include $(top_srcdir)/Makefile.swig
-
-AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES)
-
-# These headers get installed in ${prefix}/include/gnuradio
-grinclude_HEADERS = \
- cvsd_decode_bs.h \
- cvsd_encode_sb.h
-
-lib_LTLIBRARIES = libgnuradio-cvsd-vocoder.la
-
-libgnuradio_cvsd_vocoder_la_SOURCES = \
- cvsd_decode_bs.cc \
- cvsd_encode_sb.cc
-
-libgnuradio_cvsd_vocoder_la_LIBADD = \
- $(GNURADIO_CORE_LA)
-
-libgnuradio_cvsd_vocoder_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
-
-###################################
-# SWIG interface and library
-
-TOP_SWIG_IFILES = \
- cvsd_vocoder.i
-
-# Install so that they end up available as:
-# import gnuradio.vocoder.cvsd_vocoder
-# This ends up at:
-# ${prefix}/lib/python${python_version}/site-packages/gnuradio/vocoder
-cvsd_vocoder_pythondir_category = \
- gnuradio/vocoder
-
-# additional libraries for linking with the SWIG-generated library
-cvsd_vocoder_la_swig_libadd = \
- libgnuradio-cvsd-vocoder.la
diff --git a/gr-cvsd-vocoder/src/lib/Makefile.swig.gen b/gr-cvsd-vocoder/src/lib/Makefile.swig.gen
deleted file mode 100644
index e23427a0f..000000000
--- a/gr-cvsd-vocoder/src/lib/Makefile.swig.gen
+++ /dev/null
@@ -1,145 +0,0 @@
-# -*- Makefile -*-
-#
-# Copyright 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.
-#
-
-# Makefile.swig.gen for cvsd_vocoder.i
-
-## Default install locations for these files:
-##
-## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/cvsd_vocoder
-## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/cvsd_vocoder
-##
-## The following can be overloaded to change the install location, but
-## this has to be done in the including Makefile.am -before-
-## Makefile.swig is included.
-
-cvsd_vocoder_pythondir_category ?= gnuradio/cvsd_vocoder
-cvsd_vocoder_pylibdir_category ?= $(cvsd_vocoder_pythondir_category)
-cvsd_vocoder_pythondir = $(pythondir)/$(cvsd_vocoder_pythondir_category)
-cvsd_vocoder_pylibdir = $(pyexecdir)/$(cvsd_vocoder_pylibdir_category)
-
-# The .so libraries for the guile modules get installed whereever guile
-# is installed, usually /usr/lib/guile/gnuradio/
-# FIXME: determince whether these should be installed with gnuradio.
-cvsd_vocoder_scmlibdir = $(libdir)
-
-# The scm files for the guile modules get installed where ever guile
-# is installed, usually /usr/share/guile/site/cvsd_vocoder
-# FIXME: determince whether these should be installed with gnuradio.
-cvsd_vocoder_scmdir = $(guiledir)
-
-## SWIG headers are always installed into the same directory.
-
-cvsd_vocoder_swigincludedir = $(swigincludedir)
-
-## This is a template file for a "generated" Makefile addition (in
-## this case, "Makefile.swig.gen"). By including the top-level
-## Makefile.swig, this file will be used to generate the SWIG
-## dependencies. Assign the variable TOP_SWIG_FILES to be the list of
-## SWIG .i files to generated wrappings for; there can be more than 1
-## so long as the names are unique (no sorting is done on the
-## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i
-## file will generate .cc, .py, and possibly .h files -- meaning that
-## all of these files will have the same base name (that provided for
-## the SWIG .i file).
-##
-## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
-## right thing. For more info, see <
-## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-
-## Other cleaned files: dependency files generated by SWIG or this Makefile
-
-MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-
-## Various SWIG variables. These can be overloaded in the including
-## Makefile.am by setting the variable value there, then including
-## Makefile.swig .
-
-cvsd_vocoder_swiginclude_HEADERS = \
- cvsd_vocoder.i \
- $(cvsd_vocoder_swiginclude_headers)
-
-if PYTHON
-cvsd_vocoder_pylib_LTLIBRARIES = \
- _cvsd_vocoder.la
-
-_cvsd_vocoder_la_SOURCES = \
- python/cvsd_vocoder.cc \
- $(cvsd_vocoder_la_swig_sources)
-
-cvsd_vocoder_python_PYTHON = \
- cvsd_vocoder.py \
- $(cvsd_vocoder_python)
-
-_cvsd_vocoder_la_LIBADD = \
- $(STD_SWIG_LA_LIB_ADD) \
- $(cvsd_vocoder_la_swig_libadd)
-
-_cvsd_vocoder_la_LDFLAGS = \
- $(STD_SWIG_LA_LD_FLAGS) \
- $(cvsd_vocoder_la_swig_ldflags)
-
-_cvsd_vocoder_la_CXXFLAGS = \
- $(STD_SWIG_CXX_FLAGS) \
- -I$(top_builddir) \
- $(cvsd_vocoder_la_swig_cxxflags)
-
-python/cvsd_vocoder.cc: cvsd_vocoder.py
-cvsd_vocoder.py: cvsd_vocoder.i
-
-# Include the python dependencies for this file
--include python/cvsd_vocoder.d
-
-endif # end of if python
-
-if GUILE
-
-cvsd_vocoder_scmlib_LTLIBRARIES = \
- libguile-gnuradio-cvsd_vocoder.la
-libguile_gnuradio_cvsd_vocoder_la_SOURCES = \
- guile/cvsd_vocoder.cc \
- $(cvsd_vocoder_la_swig_sources)
-nobase_cvsd_vocoder_scm_DATA = \
- gnuradio/cvsd_vocoder.scm \
- gnuradio/cvsd_vocoder-primitive.scm
-libguile_gnuradio_cvsd_vocoder_la_LIBADD = \
- $(STD_SWIG_LA_LIB_ADD) \
- $(cvsd_vocoder_la_swig_libadd)
-libguile_gnuradio_cvsd_vocoder_la_LDFLAGS = \
- $(STD_SWIG_LA_LD_FLAGS) \
- $(cvsd_vocoder_la_swig_ldflags)
-libguile_gnuradio_cvsd_vocoder_la_CXXFLAGS = \
- $(STD_SWIG_CXX_FLAGS) \
- -I$(top_builddir) \
- $(cvsd_vocoder_la_swig_cxxflags)
-
-guile/cvsd_vocoder.cc: gnuradio/cvsd_vocoder.scm
-gnuradio/cvsd_vocoder.scm: cvsd_vocoder.i
-gnuradio/cvsd_vocoder-primitive.scm: gnuradio/cvsd_vocoder.scm
-
-# Include the guile dependencies for this file
--include guile/cvsd_vocoder.d
-
-endif # end of GUILE
-
-
diff --git a/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.cc b/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.cc
deleted file mode 100644
index 26dcb29da..000000000
--- a/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.cc
+++ /dev/null
@@ -1,193 +0,0 @@
-/* -*- c++ -*- */
-/*
- * 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.
- */
-
-/*
- * config.h is generated by configure. It contains the results
- * of probing for features, options etc. It should be the first
- * file included in your .cc file.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <cvsd_decode_bs.h>
-#include <gr_io_signature.h>
-#include <limits.h>
-
-/*
- * Create a new instance of cvsd_decode_bs and return
- * a boost shared_ptr. This is effectively the public constructor.
- */
-cvsd_decode_bs_sptr
-cvsd_make_decode_bs (short min_step, short max_step, double step_decay,
- double accum_decay, int K, int J,
- short pos_accum_max, short neg_accum_max)
-{
- return gnuradio::get_initial_sptr(new cvsd_decode_bs (min_step, max_step,
- step_decay, accum_decay, K, J,
- pos_accum_max, neg_accum_max));
-}
-
-cvsd_decode_bs::cvsd_decode_bs (short min_step, short max_step, double step_decay,
- double accum_decay, int K, int J,
- short pos_accum_max, short neg_accum_max)
- : gr_sync_interpolator ("cvsd_decode_bs",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (short)),
- 8),
- d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay),
- d_accum_decay(accum_decay), d_K(K), d_J(J),
- d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max),
- d_accum(0),
- d_loop_counter(1),
- d_runner(0),
- d_runner_mask(0),
- d_stepsize(min_step)
-
-{
- assert(d_K <= 32);
- assert(d_J <= d_K);
-}
-
-
-cvsd_decode_bs::~cvsd_decode_bs ()
-{
- // nothing else required in this example
-}
-
-unsigned char cvsd_decode_bs::cvsd_bitwise_sum (unsigned int input)
-{
- unsigned int temp=input;
- unsigned char bits=0;
-
- while(temp) {
- temp=temp&(temp-1);
- bits++;
- }
- return bits;
-}
-
-int cvsd_decode_bs::cvsd_round (double input)
-{
- double temp;
- temp=input+0.5;
- temp=floor(temp);
-
- return (int)temp;
-}
-
-unsigned int cvsd_decode_bs::cvsd_pow (short radix, short power)
-{
- double d_radix = (double) radix;
- int i_power = (int) power;
- double output;
-
- output=pow(d_radix,i_power);
- return ( (unsigned int) cvsd_round(output));
-}
-
-
-int
-cvsd_decode_bs::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
-
-
- const unsigned char *in = (const unsigned char *) input_items[0];
- short *out = (short *) output_items[0];
-
- int i=0;
- short output_short=0; // 2 bytes 0 .. 65,535
- unsigned char bit_count=0; // 1 byte, 0 .. 255
- unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295
- unsigned char input_byte=0; // 1 bytes
- unsigned char input_bit=0; // 1 byte, 0 .. 255
-
- // Loop through each input data point
- for(i = 0; i < noutput_items/8.0; i++) {
-
- input_byte = in[i];
- // Initiliaze bit counter
- bit_count=0;
-
- while(bit_count<8) {
- // Compute the Appropriate Mask
- mask=cvsd_pow(2,7-bit_count);
-
- // Pull off the corresponding bit
- input_bit = input_byte & mask;
-
- // Update the bit counter
- bit_count++;
-
- // Update runner with the next input bit
- // Runner is a shift-register; shift left, add on newest output bit
- d_runner = (d_runner<<1) | ((unsigned int) input_bit);
-
- // Run this only if you have >= J bits in your shift register
- if (d_loop_counter>=d_J) {
- // Update Step Size
- d_runner_mask=(cvsd_pow(2,d_J)-1);
- if ((cvsd_bitwise_sum(d_runner & d_runner_mask)>=d_J)||(cvsd_bitwise_sum((~d_runner) & d_runner_mask)>=d_J)) {
- // Runs of 1s and 0s
- d_stepsize = std::min( (short) (d_stepsize + d_min_step), d_max_step);
- }
- else {
- // No runs of 1s and 0s
- d_stepsize = std::max( (short) cvsd_round(d_stepsize*d_step_decay), d_min_step);
- }
- }
-
- // Update Accum (i.e. the reference value)
- if (input_bit) {
- d_accum=d_accum+d_stepsize;
- }
- else {
- d_accum=d_accum-d_stepsize;
- }
-
- // Multiply by Accum_Decay
- d_accum=(cvsd_round(d_accum*d_accum_decay));
-
- // Check for overflow
- if (d_accum >=((int) d_pos_accum_max)) {
- d_accum=(int)d_pos_accum_max;
- }
- else if (d_accum <=((int) d_neg_accum_max)) {
- d_accum=(int)d_neg_accum_max;
- }
-
- // Find the output short to write to the file
- output_short=((short) d_accum);
-
- if (d_loop_counter <= d_K) {
- d_loop_counter++;
- }
-
- *(out++) = output_short;
- } // while ()
-
- } // for()
-
- return noutput_items;
-}
diff --git a/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.h b/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.h
deleted file mode 100644
index f7b50909f..000000000
--- a/gr-cvsd-vocoder/src/lib/cvsd_decode_bs.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* -*- c++ -*- */
-/*
- * 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.
- */
-#ifndef INCLUDED_CVSD_DECODE_BS_H
-#define INCLUDED_CVSD_DECODE_BS_H
-
-#include <gr_sync_interpolator.h>
-
-class cvsd_decode_bs;
-
-typedef boost::shared_ptr<cvsd_decode_bs> cvsd_decode_bs_sptr;
-
- /*!
- * \brief Constructor parameters to initialize the CVSD decoder. The default
- * values are modeled after the Bluetooth standard and should not be changed,
- * except by an advanced user
- *
- * \param min_step Minimum step size used to update the internal reference. Default: "10"
- * \param max_step Maximum step size used to update the internal reference. Default: "1280"
- * \param step_decay Decay factor applied to step size when there is not a run of J output 1s or 0s. Default: "0.9990234375" (i.e. 1-1/1024)
- * \param accum_decay Decay factor applied to the internal reference during every interation of the codec. Default: "0.96875" (i.e. 1-1/32)
- * \param K; Size of shift register; the number of output bits remembered by codec (must be less or equal to 32). Default: "32"
- * \param J; Number of bits in the shift register that are equal; i.e. the size of a run of 1s, 0s. Default: "4"
- * \param pos_accum_max Maximum integer value allowed for the internal reference. Default: "32767" (2^15 - 1 or MAXSHORT)
- * \param neg_accum_max Minimum integer value allowed for the internal reference. Default: "-32767" (-2^15 + 1 or MINSHORT+1)
- *
- */
-cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step=10,
- short max_step=1280,
- double step_decay=0.9990234375,
- double accum_decay= 0.96875,
- int K=32,
- int J=4,
- short pos_accum_max=32767,
- short neg_accum_max=-32767);
-
-/*!
- * \brief This block performs CVSD audio decoding. Its design and implementation
- * is modeled after the CVSD encoder/decoder specifications defined in the
- * Bluetooth standard.
- *
- * \ingroup vocoder_blk
- *
- * CVSD is a method for encoding speech that seeks to reduce the
- * bandwidth required for digital voice transmission. CVSD takes
- * advantage of strong correlation between samples, quantizing the
- * difference in amplitude between two consecutive samples. This
- * difference requires fewer quantization levels as compared to other
- * methods that quantize the actual amplitude level, reducing the
- * bandwidth. CVSD employs a two level quantizer (one bit) and an
- * adaptive algorithm that allows for continuous step size adjustment.
- *
- * The coder can represent low amplitude signals with accuracy without
- * sacrificing performance on large amplitude signals, a trade off that
- * occurs in some non-adaptive modulations.
- *
- * The CVSD decoder effectively provides 1-to-8 decompression. More
- * specifically, for each incoming input bit, the decoder outputs one
- * audio sample. If the input is a "1" bit, the internal reference is
- * increased appropriately and then outputted as the next estimated audio
- * sample. If the input is a "0" bit, the internal reference is
- * decreased appropriately and then likewise outputted as the next estimated
- * audio sample. Grouping 8 input bits together, the encoder essentially
- * produces 8 output audio samples for everyone one input byte.
- *
- * This decoder requires that output audio samples are 2-byte short signed
- * integers. The result bandwidth conversion, therefore, is 1 byte of
- * encoded audio data to 16 output bytes of raw audio data.
- *
- * The CVSD decoder module must be post-fixed by a down-converter to
- * under-sample the audio data after decoding. The Bluetooth standard
- * specifically calls for a 8-to-1 decimating down-converter. This is
- * required so that so that output sampling rate equals the original input
- * sampling rate present before the encoder. In all cases, the output
- * down-converter rate must be the inverse of the input up-converter rate
- * before the CVSD encoder.
- *
- * References:
- * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial,
- * Available: http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF.
- * 2. Specification of The Bluetooth System
- * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf.
- * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002.
- * Bluetooth Voice Simulink® Model, Available:
- * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html
- *
- */
-
-class cvsd_decode_bs : public gr_sync_interpolator
-{
-private:
- friend cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step,
- short max_step,
- double step_decay,
- double accum_decay,
- int K,
- int J,
- short pos_accum_max,
- short neg_accum_max);
-
- cvsd_decode_bs (short min_step, short max_step, double step_decay,
- double accum_decay, int K, int J,
- short pos_accum_max, short neg_accum_max);
-
- //! Member functions required by the encoder/decoder
- //! \brief Rounding function specific to CVSD
- //! \return the input value rounded to the nearest integer
- int cvsd_round(double input);
-
- //! \brief A power function specific to CVSD data formats
- //! \return (radix)^power, where radix and power are short integers
- unsigned int cvsd_pow (short radix, short power);
-
- //! \brief Sums number of 1's in the input
- //! \return the number of 1s in the four bytes of an input unsigned integer
- unsigned char cvsd_bitwise_sum (unsigned int input);
-
- short d_min_step;
- short d_max_step;
- double d_step_decay;
- double d_accum_decay;
-
- int d_K; //!< \brief Size of shift register; the number of output bits remembered in shift register
- int d_J; //!< \brief Number of bits in the shift register that are equal; size of run of 1s, 0s
-
- short d_pos_accum_max;
- short d_neg_accum_max;
-
- int d_accum; //!< \brief Current value of internal reference
- int d_loop_counter; //!< \brief Current value of the loop counter
- unsigned int d_runner; //!< \brief Current value of the shift register
- unsigned int d_runner_mask; //!< \brief Value of the mask to access the last J bits of the shift register
- short d_stepsize; //!< \brief Current value of the step sizer
-
- public:
- ~cvsd_decode_bs (); // public destructor
-
- short min_step() { return d_min_step; }
- short max_step() { return d_max_step; }
- double step_decay() { return d_step_decay; }
- double accum_decay() { return d_accum_decay; }
- int K() { return d_K; }
- int J() { return d_J; }
- short pos_accum_max() { return d_pos_accum_max; }
- short neg_accum_max() { return d_neg_accum_max; }
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_CVSD_DECODE_BS_H */
diff --git a/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.cc b/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.cc
deleted file mode 100644
index df867f3ba..000000000
--- a/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.cc
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- c++ -*- */
-/*
- * 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.
- */
-
-/*
- * config.h is generated by configure. It contains the results
- * of probing for features, options etc. It should be the first
- * file included in your .cc file.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <cvsd_encode_sb.h>
-#include <gr_io_signature.h>
-#include <limits.h>
-
-/*
- * Create a new instance of cvsd_encode_sb and return
- * a boost shared_ptr. This is effectively the public constructor.
- */
-cvsd_encode_sb_sptr
-cvsd_make_encode_sb (short min_step, short max_step, double step_decay,
- double accum_decay, int K, int J,
- short pos_accum_max, short neg_accum_max)
-{
- return gnuradio::get_initial_sptr(new cvsd_encode_sb (min_step, max_step,
- step_decay, accum_decay, K, J,
- pos_accum_max, neg_accum_max));
-}
-
-cvsd_encode_sb::cvsd_encode_sb (short min_step, short max_step, double step_decay,
- double accum_decay, int K, int J,
- short pos_accum_max, short neg_accum_max)
- : gr_sync_decimator ("cvsd_encode_sb",
- gr_make_io_signature (1, 1, sizeof (short)),
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- 8),
- d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay),
- d_accum_decay(accum_decay), d_K(K), d_J(J),
- d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max),
- d_accum(0),
- d_loop_counter(1),
- d_runner(0),
- d_stepsize(min_step)
-
-{
- assert(d_K <= 32);
- assert(d_J <= d_K);
-}
-
-
-cvsd_encode_sb::~cvsd_encode_sb ()
-{
- // nothing else required in this example
-}
-
-unsigned char cvsd_encode_sb::cvsd_bitwise_sum (unsigned int input)
-{
- unsigned int temp=input;
- unsigned char bits=0;
-
- while(temp) {
- temp=temp&(temp-1);
- bits++;
- }
- return bits;
-}
-
-int cvsd_encode_sb::cvsd_round (double input)
-{
- double temp;
- temp=input+0.5;
- temp=floor(temp);
-
- return (int)temp;
-}
-
-unsigned int cvsd_encode_sb::cvsd_pow (short radix, short power)
-{
- double d_radix = (double) radix;
- int i_power = (int) power;
- double output;
-
- output=pow(d_radix,i_power);
- return ( (unsigned int) cvsd_round(output));
-}
-
-
-
-int
-cvsd_encode_sb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const short *in = (const short *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- unsigned short i=0; // 2 bytes, 0 .. 65,535
- unsigned char output_bit=0; // 1 byte, 0 .. 255
- unsigned char output_byte=0; // 1 bytes 0.255
- unsigned char bit_count=0; // 1 byte, 0 .. 255
- unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295
-
- // Loop through each input data point
- for(i = 0; i < noutput_items*8; i++) {
- if((int)in[i] >= d_accum) { // Note: sign((data(n)-accum))
- output_bit=1;
- }
- else {
- output_bit=0;
- }
-
- // Update Accum (i.e. the reference value)
- if (output_bit) {
- d_accum=d_accum+d_stepsize;
- //printf("Addding %d to the accum; the result is: %d.\n", d_stepsize, d_accum);
- }
- else {
- d_accum=d_accum-d_stepsize;
- //printf("Subtracting %d to the accum; the result is: %d.\n", d_stepsize, d_accum);
- }
-
- // Multiply by Accum_Decay
- d_accum=(cvsd_round(d_accum*d_accum_decay));
-
- // Check for overflow
- if (d_accum >= ((int)d_pos_accum_max)) {
- d_accum = (int)d_pos_accum_max;
- }
- else if(d_accum <= ((int) d_neg_accum_max)) {
- d_accum = (int) d_neg_accum_max;
- }
-
- // Update runner with the last output bit
- // Update Step Size
- if (d_loop_counter >= d_J) { // Run this only if you have >= J bits in your shift register
- mask=(cvsd_pow(2, d_J) - 1);
- if ((cvsd_bitwise_sum(d_runner & mask) >= d_J) || (cvsd_bitwise_sum((~d_runner) & mask) >= d_J)) {
- // Runs of 1s and 0s
- d_stepsize = std::min( (short)(d_stepsize + d_min_step), d_max_step);
- }
- else {
- // No runs of 1s and 0s
- d_stepsize = std::max( (short)cvsd_round(d_stepsize*d_step_decay), d_min_step);
- }
- }
-
- // Runner is a shift-register; shift left, add on newest output bit
- d_runner = (d_runner<<1) | ((unsigned int) output_bit);
-
- // Update the ouput type; shift left, add on newest output bit
- // If you have put in 8 bits, output it as a byte
- output_byte = (output_byte<<1) | output_bit;
- bit_count++;
-
- if (d_loop_counter <= d_K) {
- d_loop_counter++;
- }
-
- // If you have put 8 bits, output and clear.
- if (bit_count==8) {
- // Read in short from the file
- *(out++) = output_byte;
-
- // Reset the bit_count
- bit_count=0;
- output_byte=0;
- }
- } // While
-
- return noutput_items;
-}
diff --git a/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.h b/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.h
deleted file mode 100644
index a7994d4ed..000000000
--- a/gr-cvsd-vocoder/src/lib/cvsd_encode_sb.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- c++ -*- */
-/*
- * 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.
- */
-#ifndef INCLUDED_CVSD_ENCODER_SB_H
-#define INCLUDED_CVSD_ENCODER_SB_H
-
-#include <gr_sync_decimator.h>
-
-class cvsd_encode_sb;
-
-typedef boost::shared_ptr<cvsd_encode_sb> cvsd_encode_sb_sptr;
-
- /*!
- * \brief Constructor parameters to initialize the CVSD encoder. The default
- * values are modeled after the Bluetooth standard and should not be changed
- * except by an advanced user
- *
- * \param min_step Minimum step size used to update the internal reference. Default: "10"
- * \param max_step Maximum step size used to update the internal reference. Default: "1280"
- * \param step_decay Decay factor applied to step size when there is not a run of J output 1s or 0s. Default: "0.9990234375" (i.e. 1-1/1024)
- * \param accum_decay Decay factor applied to the internal reference during every interation of the codec. Default: "0.96875" (i.e. 1-1/32)
- * \param K; Size of shift register; the number of output bits remembered by codec (must be less or equal to 32). Default: "32"
- * \param J; Number of bits in the shift register that are equal; i.e. the size of a run of 1s, 0s. Default: "4"
- * \param pos_accum_max Maximum integer value allowed for the internal reference. Default: "32767" (2^15 - 1 or MAXSHORT)
- * \param neg_accum_max Minimum integer value allowed for the internal reference. Default: "-32767" (-2^15 + 1 or MINSHORT+1)
- *
- */
-
-cvsd_encode_sb_sptr cvsd_make_encode_sb (short min_step=10,
- short max_step=1280,
- double step_decay=0.9990234375,
- double accum_decay= 0.96875,
- int K=32,
- int J=4,
- short pos_accum_max=32767,
- short neg_accum_max=-32767);
-
-/*!
- * \brief This block performs CVSD audio encoding. Its design and implementation
- * is modeled after the CVSD encoder/decoder specifications defined in the
- * Bluetooth standard.
- *
- * \ingroup vocoder_blk
- *
- * CVSD is a method for encoding speech that seeks to reduce the
- * bandwidth required for digital voice transmission. CVSD takes
- * advantage of strong correlation between samples, quantizing the
- * difference in amplitude between two consecutive samples. This
- * difference requires fewer quantization levels as compared to other
- * methods that quantize the actual amplitude level, reducing the
- * bandwidth. CVSD employs a two level quantizer (one bit) and an
- * adaptive algorithm that allows for continuous step size adjustment.
- *
- * The coder can represent low amplitude signals with accuracy without
- * sacrificing performance on large amplitude signals, a trade off that
- * occurs in some non-adaptive modulations.
- *
- * The CVSD encoder effectively provides 8-to-1 compression. More
- * specifically, each incoming audio sample is compared to an internal
- * reference value. If the input is greater or equal to the reference,
- * the encoder outputs a "1" bit. If the input is less than the reference,
- * the encoder outputs a "0" bit. The reference value is then updated
- * accordingly based on the frequency of outputted "1" or "0" bits. By
- * grouping 8 outputs bits together, the encoder essentially produce one
- * output byte for every 8 input audio samples.
- *
- * This encoder requires that input audio samples are 2-byte short signed
- * integers. The result bandwidth conversion, therefore, is 16 input bytes
- * of raw audio data to 1 output byte of encoded audio data.
- *
- * The CVSD encoder module must be prefixed by an up-converter to over-sample
- * the audio data prior to encoding. The Bluetooth standard specifically
- * calls for a 1-to-8 interpolating up-converter. While this reduces the
- * overall compression of the codec, this is required so that the encoder
- * can accurately compute the slope between adjacent audio samples and
- * correctly update its internal reference value.
- *
- * References:
- *
- * 1. Continuously Variable Slope Delta Modulation (CVSD) A Tutorial,
- * Available: http://www.eetkorea.com/ARTICLES/2003AUG/A/2003AUG29_NTEK_RFD_AN02.PDF.
- *
- * 2. Specification of The Bluetooth System
- * Available: http://grouper.ieee.org/groups/802/15/Bluetooth/core_10_b.pdf.
- *
- * 3. McGarrity, S., Bluetooth Full Duplex Voice and Data Transmission. 2002.
- * Bluetooth Voice Simulink® Model, Available:
- * http://www.mathworks.com/company/newsletters/digest/nov01/bluetooth.html
- *
- */
-
-class cvsd_encode_sb : public gr_sync_decimator
-{
-private:
- friend cvsd_encode_sb_sptr cvsd_make_encode_sb (short min_step,
- short max_step,
- double step_decay,
- double accum_decay,
- int K,
- int J,
- short pos_accum_max,
- short neg_accum_max);
-
- cvsd_encode_sb (short min_step, short max_step, double step_decay,
- double accum_decay, int K, int J,
- short pos_accum_max, short neg_accum_max);
-
- //! Member functions required by the encoder/decoder
- //! \brief Rounding function specific to CVSD
- //! \return the input value rounded to the nearest integer
- int cvsd_round(double input);
-
- //! \brief A power function specific to CVSD data formats
- //! \return (radix)^power, where radix and power are short integers
- unsigned int cvsd_pow (short radix, short power);
-
- //! \brief Sums number of 1's in the input
- //! \return the number of 1s in the four bytes of an input unsigned integer
- unsigned char cvsd_bitwise_sum (unsigned int input);
-
- // Members variables related to the CVSD encoder use to update interal reference value
- short d_min_step;
- short d_max_step;
- double d_step_decay;
- double d_accum_decay;
-
- int d_K; //!< \brief Size of shift register; the number of output bits remembered in shift register
- int d_J; //!< \brief Number of bits in the shift register that are equal; size of run of 1s, 0s
-
- short d_pos_accum_max;
- short d_neg_accum_max;
-
- int d_accum; //!< \brief Current value of internal reference
- int d_loop_counter; //!< \brief Current value of the loop counter
- unsigned int d_runner; //!< \brief Current value of the shift register
- short d_stepsize; //!< \brief Current value of the step sizer
-
- public:
- ~cvsd_encode_sb (); // public destructor
-
- short min_step() { return d_min_step; }
- short max_step() { return d_max_step; }
- double step_decay() { return d_step_decay; }
- double accum_decay() { return d_accum_decay; }
- int K() { return d_K; }
- int J() { return d_J; }
- short pos_accum_max() { return d_pos_accum_max; }
- short neg_accum_max() { return d_neg_accum_max; }
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_CVSD_ENCODE_SB_H */
diff --git a/gr-cvsd-vocoder/src/lib/cvsd_vocoder.i b/gr-cvsd-vocoder/src/lib/cvsd_vocoder.i
deleted file mode 100644
index 82662e84e..000000000
--- a/gr-cvsd-vocoder/src/lib/cvsd_vocoder.i
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,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 "gnuradio.i"
-
-%{
-#include "cvsd_encode_sb.h"
-#include "cvsd_decode_bs.h"
-%}
-
-GR_SWIG_BLOCK_MAGIC(cvsd,encode_sb);
-
-cvsd_encode_sb_sptr cvsd_make_encode_sb (short min_step=10,
- short max_step=1280,
- double step_decay=0.9990234375,
- double accum_decay= 0.96875,
- int K=32,
- int J=4,
- short pos_accum_max=32767,
- short neg_accum_max=-32767);
-
-class cvsd_encode_sb : public gr_sync_decimator
-{
-private:
- cvsd_encode_sb (short min_step, short max_step, double step_decay,
- double accum_decay, int K, int J,
- short pos_accum_max, short neg_accum_max);
-
-
- public:
- short min_step() { return d_min_step; }
- short max_step() { return d_max_step; }
- double step_decay() { return d_step_decay; }
- double accum_decay() { return d_accum_decay; }
- int K() { return d_K; }
- int J() { return d_J; }
- short pos_accum_max() { return d_pos_accum_max; }
- short neg_accum_max() { return d_neg_accum_max; }
-};
-
-// ----------------------------------------------------------------
-
-GR_SWIG_BLOCK_MAGIC(cvsd,decode_bs);
-
-cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step=10,
- short max_step=1280,
- double step_decay=0.9990234375,
- double accum_decay= 0.96875,
- int K=32,
- int J=4,
- short pos_accum_max=32767,
- short neg_accum_max=-32767);
-
-class cvsd_decode_bs : public gr_sync_interpolator
-{
-private:
- cvsd_decode_bs (short min_step, short max_step, double step_decay,
- double accum_decay, int K, int J,
- short pos_accum_max, short neg_accum_max);
-
- public:
-};
-
-#if SWIGGUILE
-%scheme %{
-(load-extension-global "libguile-gnuradio-cvsd_vocoder" "scm_init_gnuradio_cvsd_vocoder_module")
-%}
-
-%goops %{
-(use-modules (gnuradio gnuradio_core_runtime))
-%}
-#endif
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@