Index: interfaces/python/a_weighting_test_simple.expected
===================================================================
--- interfaces/python/a_weighting_test_simple.expected	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
+++ interfaces/python/a_weighting_test_simple.expected	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
@@ -0,0 +1,2 @@
+ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 5.00000000e-01 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
+ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.27870563e-01 2.58244342e-01 1.18719361e-01 -4.02623805e-02 -5.61812129e-02 -5.24739734e-02 -4.72329276e-02 -4.23394349e-02 -3.79219586e-02 -3.39473148e-02 -3.03724479e-02 -2.71574847e-02 -2.42664433e-02 -2.16669285e-02 -1.93297810e-02 -1.72287543e-02 -1.53402241e-02 -1.36429261e-02 -1.21177207e-02 -1.07473802e-02
Index: interfaces/python/aubio-types.h
===================================================================
--- interfaces/python/aubio-types.h	(revision ccf8b77918b5c8a4e8335371bd5e8e0670b6d979)
+++ interfaces/python/aubio-types.h	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
@@ -5,6 +5,8 @@
 #include <aubio.h>
 
-#define Py_fvec_default_length   1024
-#define Py_fvec_default_channels 1
+#define Py_default_vector_length   1024
+#define Py_default_vector_channels 1
+
+#define Py_aubio_default_samplerate 44100
 
 #ifdef HAVE_AUBIO_DOUBLE
@@ -25,5 +27,6 @@
 typedef struct
 {
-  PyObject_HEAD fvec_t * o;
+  PyObject_HEAD
+  fvec_t * o;
   uint_t length;
   uint_t channels;
@@ -31,4 +34,8 @@
 extern PyTypeObject Py_fvecType;
 
+extern PyTypeObject Py_cvecType;
+
+extern PyTypeObject Py_filterType;
+
 extern PyObject *PyAubio_FvecToArray (Py_fvec * self);
 
Index: interfaces/python/aubiomodule.c
===================================================================
--- interfaces/python/aubiomodule.c	(revision ccf8b77918b5c8a4e8335371bd5e8e0670b6d979)
+++ interfaces/python/aubiomodule.c	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
@@ -97,12 +97,9 @@
   //return Py_None;
   // however it is convenient to return the modified vector 
-  //return (PyObject *) PyAubio_FvecToArray(vec);
+  return (PyObject *) PyAubio_FvecToArray(vec);
   // or even without converting it back to an array
-  Py_INCREF(vec);
-  return (PyObject *)vec;
+  //Py_INCREF(vec);
+  //return (PyObject *)vec;
 }
-
-  
-
 
 static PyMethodDef aubio_methods[] = {
@@ -122,5 +119,7 @@
   int err;
 
-  if (PyType_Ready (&Py_fvecType) < 0) {
+  if ((PyType_Ready (&Py_fvecType) < 0) ||
+      (PyType_Ready (&Py_cvecType) < 0) ||
+      (PyType_Ready (&Py_filterType) < 0)) {
     return;
   }
@@ -141,3 +140,7 @@
   Py_INCREF (&Py_fvecType);
   PyModule_AddObject (m, "fvec", (PyObject *) & Py_fvecType);
+  Py_INCREF (&Py_cvecType);
+  PyModule_AddObject (m, "cvec", (PyObject *) & Py_cvecType);
+  Py_INCREF (&Py_filterType);
+  PyModule_AddObject (m, "digital_filter", (PyObject *) & Py_filterType);
 }
Index: interfaces/python/c_weighting_test_simple.expected
===================================================================
--- interfaces/python/c_weighting_test_simple.expected	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
+++ interfaces/python/c_weighting_test_simple.expected	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
@@ -0,0 +1,2 @@
+ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 5.00000000e-01 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
+ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.08504281e-01 2.31621372e-01 1.38614617e-01 1.58040475e-02 -9.84900252e-04 -2.72686896e-03 -2.87772967e-03 -2.87932142e-03 -2.86783482e-03 -2.85529016e-03 -2.84270413e-03 -2.83016008e-03 -2.81766458e-03 -2.80521796e-03 -2.79282009e-03 -2.78047079e-03 -2.76816989e-03 -2.75591721e-03 -2.74371257e-03 -2.73155579e-03
Index: interfaces/python/py-fvec.c
===================================================================
--- interfaces/python/py-fvec.c	(revision ccf8b77918b5c8a4e8335371bd5e8e0670b6d979)
+++ interfaces/python/py-fvec.c	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
@@ -28,6 +28,6 @@
   self = (Py_fvec *) type->tp_alloc (type, 0);
 
-  self->length = Py_fvec_default_length;
-  self->channels = Py_fvec_default_channels;
+  self->length = Py_default_vector_length;
+  self->channels = Py_default_vector_channels;
 
   if (self == NULL) {
@@ -51,5 +51,4 @@
   }
 
-
   return (PyObject *) self;
 }
@@ -89,4 +88,5 @@
     goto fail;
   }
+  fvec_print ( self->o );
 
   result = PyString_Format (format, args);
@@ -97,11 +97,4 @@
 
   return result;
-}
-
-static PyObject *
-Py_fvec_print (Py_fvec * self, PyObject * unused)
-{
-  fvec_print (self->o);
-  return Py_None;
 }
 
@@ -111,4 +104,8 @@
   Py_fvec *vec;
   uint_t i;
+  if (input == NULL) {
+    PyErr_SetString (PyExc_ValueError, "input array is not a python object");
+    goto fail;
+  }
   // parsing input object into a Py_fvec
   if (PyObject_TypeCheck (input, &Py_fvecType)) {
@@ -267,6 +264,4 @@
 
 static PyMethodDef Py_fvec_methods[] = {
-  {"dump", (PyCFunction) Py_fvec_print, METH_NOARGS,
-      "Dumps the contents of the vector to stdout."},
   {"__array__", (PyCFunction) PyAubio_FvecToArray, METH_NOARGS,
       "Returns the first channel as a numpy array."},
Index: interfaces/python/setup.py
===================================================================
--- interfaces/python/setup.py	(revision ccf8b77918b5c8a4e8335371bd5e8e0670b6d979)
+++ interfaces/python/setup.py	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
@@ -4,5 +4,5 @@
       ext_modules = [ 
         Extension("_aubio",
-            ["aubiomodule.c", "py-fvec.c"],
+            ["aubiomodule.c", "py-fvec.c", "py-cvec.c", "py-filter.c"],
             include_dirs=['../../build/default/src', '../../src' ],
             library_dirs=['../../build/default/src', '../../src/.libs' ],
Index: interfaces/python/test_aubio.py
===================================================================
--- interfaces/python/test_aubio.py	(revision ccf8b77918b5c8a4e8335371bd5e8e0670b6d979)
+++ interfaces/python/test_aubio.py	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
@@ -1,11 +1,8 @@
 from numpy.testing import TestCase, run_module_suite
-from numpy.testing import assert_equal as numpy_assert_equal
+from numpy.testing import assert_equal
 from _aubio import *
 from numpy import array
 
 AUBIO_DO_CASTING = 0
-
-def assert_equal(a, b):
-  numpy_assert_equal(array(a),array(b))
 
 class aubiomodule_test_case(TestCase):
Index: interfaces/python/test_filter.py
===================================================================
--- interfaces/python/test_filter.py	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
+++ interfaces/python/test_filter.py	(revision 9b23eb311431d5862a5920b69082cca1a93bcb8e)
@@ -0,0 +1,67 @@
+from numpy.testing import TestCase, run_module_suite
+from numpy.testing import assert_equal, assert_almost_equal
+from _aubio import *
+from numpy import array
+
+def array_from_text_file(filename, dtype = 'float'):
+  return array([line.split() for line in open(filename).readlines()], 
+      dtype = dtype)
+
+class aubio_filter_test_case(TestCase):
+
+  def test_members(self):
+    f = digital_filter()
+    assert_equal ([f.channels, f.order, f.samplerate], [1, 7, 44100])
+    f = digital_filter(48000, 5, 2)
+    assert_equal ([f.channels, f.order, f.samplerate], [2, 5, 48000])
+    f(fvec())
+  
+  def test_cweighting_error(self):
+    f = digital_filter (44100, 2, 1)
+    self.assertRaises ( ValueError, f.set_c_weighting )
+    f = digital_filter (44100, 8, 1)
+    self.assertRaises ( ValueError, f.set_c_weighting )
+    f = digital_filter (4000, 5, 1)
+    self.assertRaises ( ValueError, f.set_c_weighting )
+    f = digital_filter (193000, 5, 1)
+    self.assertRaises ( ValueError, f.set_c_weighting )
+    f = digital_filter (193000, 7, 1)
+    self.assertRaises ( ValueError, f.set_a_weighting )
+    f = digital_filter (192000, 5, 1)
+    self.assertRaises ( ValueError, f.set_a_weighting )
+
+  def test_c_weighting(self):
+    expected = array_from_text_file('c_weighting_test_simple.expected')
+    f = digital_filter(44100, 5, 1)
+    f.set_c_weighting()
+    v = fvec(32)
+    v[0][12] = .5
+    u = f(v)
+    assert_almost_equal (expected[1], u)
+
+  def test_a_weighting(self):
+    expected = array_from_text_file('a_weighting_test_simple.expected')
+    f = digital_filter(44100, 7, 1)
+    f.set_a_weighting()
+    v = fvec(32)
+    v[0][12] = .5
+    u = f(v)
+    assert_almost_equal (expected[1], u)
+
+  def test_a_weighting_parted(self):
+    expected = array_from_text_file('a_weighting_test_simple.expected')
+    f = digital_filter(44100, 7, 1)
+    f.set_a_weighting()
+    v = fvec(16)
+    v[0][12] = .5
+    u = f(v)
+    assert_almost_equal (expected[1][:16], u)
+    # one more time
+    v = fvec(16)
+    u = f(v)
+    assert_almost_equal (expected[1][16:], u)
+
+if __name__ == '__main__':
+  from unittest import main
+  main()
+
