Index: python/lib/gen_code.py
===================================================================
--- python/lib/gen_code.py	(revision 1929be4c880ca872dd79f0d8dfa77145721d1b52)
+++ python/lib/gen_code.py	(revision 189c6ae6ed15ad2875bb0331110f681949fe2868)
@@ -3,4 +3,5 @@
     'buf_size': 'Py_default_vector_length',
     'win_s': 'Py_default_vector_length',
+    'size': 'Py_default_vector_length',
     # and here too
     'hop_size': 'Py_default_vector_length / 2',
@@ -83,4 +84,5 @@
         'filterbank': 'self->n_filters',
         'tss': 'self->buf_size',
+        'dct': 'self->size',
         }
 
@@ -191,4 +193,9 @@
             out += self.gen_del()
             out += self.gen_do()
+            if len(self.prototypes['rdo']):
+                self.do_proto = self.prototypes['rdo'][0]
+                self.do_inputs = [get_params_types_names(self.do_proto)[1]]
+                self.do_outputs = get_params_types_names(self.do_proto)[2:]
+                out += self.gen_do(method='rdo')
             out += self.gen_memberdef()
             out += self.gen_set()
@@ -371,10 +378,10 @@
         return out
 
-    def gen_do(self):
+    def gen_do(self, method = 'do'):
         out = """
 // do {shortname}
 static PyObject*
-Py_{shortname}_do  (Py_{shortname} * self, PyObject * args)
-{{""".format(**self.__dict__)
+Pyaubio_{shortname}_{method}  (Py_{shortname} * self, PyObject * args)
+{{""".format(**self.__dict__, method = method)
         input_params = self.do_inputs
         output_params = self.do_outputs
@@ -516,4 +523,10 @@
   {{"{shortname}", (PyCFunction) Py{name},
     METH_NOARGS, ""}},""".format(name = name, shortname = shortname)
+        for m in self.prototypes['rdo']:
+            name = get_name(m)
+            shortname = name.replace('aubio_%s_' % self.shortname, '')
+            out += """
+  {{"{shortname}", (PyCFunction) Py{name},
+    METH_VARARGS, ""}},""".format(name = name, shortname = shortname)
         out += """
   {NULL} /* sentinel */
@@ -541,5 +554,5 @@
   0,
   0,
-  (ternaryfunc)Py_{shortname}_do,
+  (ternaryfunc)Pyaubio_{shortname}_do,
   0,
   0,
Index: python/lib/gen_external.py
===================================================================
--- python/lib/gen_external.py	(revision 1929be4c880ca872dd79f0d8dfa77145721d1b52)
+++ python/lib/gen_external.py	(revision 189c6ae6ed15ad2875bb0331110f681949fe2868)
@@ -182,5 +182,5 @@
             shortname = o[6:-2]  # without aubio_ prefix and _t suffix
 
-        lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'get': [], 'set': [], 'other': []}
+        lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'rdo': [], 'get': [], 'set': [], 'other': []}
         lib[shortname]['longname'] = o
         lib[shortname]['shortname'] = shortname
@@ -196,4 +196,6 @@
                 elif '_do' in fn:
                     lib[shortname]['do'].append(fn)
+                elif '_rdo' in fn:
+                    lib[shortname]['rdo'].append(fn)
                 elif 'new_' in fn:
                     lib[shortname]['new'].append(fn)
Index: python/tests/test_dct.py
===================================================================
--- python/tests/test_dct.py	(revision 189c6ae6ed15ad2875bb0331110f681949fe2868)
+++ python/tests/test_dct.py	(revision 189c6ae6ed15ad2875bb0331110f681949fe2868)
@@ -0,0 +1,68 @@
+#! /usr/bin/env python
+
+
+import numpy as np
+from numpy.testing import TestCase, assert_almost_equal
+import aubio
+
+precomputed_arange = [ 9.89949512, -6.44232273,  0., -0.67345482, 0.,
+        -0.20090288, 0., -0.05070186]
+
+precomputed_some_ones = [ 4.28539848,  0.2469689,  -0.14625292, -0.58121818,
+        -0.83483052, -0.75921834, -0.35168475,  0.24087936,
+        0.78539824, 1.06532764,  0.97632152,  0.57164496, 0.03688532,
+        -0.39446154, -0.54619485, -0.37771079]
+
+class aubio_dct(TestCase):
+
+    def test_init(self):
+        """ test that aubio.dct() is created with expected size """
+        a_dct = aubio.dct()
+        self.assertEqual(a_dct.size, 1024)
+
+    def test_arange(self):
+        """ test that dct(arange(8)) is computed correctly
+
+        >>> from scipy.fftpack import dct
+        >>> a_in = np.arange(8).astype('float32')
+        >>> precomputed = dct(a_in, norm='ortho')
+        """
+        N = len(precomputed_arange)
+        a_dct = aubio.dct(8)
+        a_in = np.arange(8).astype('float32')
+        a_expected = aubio.fvec(precomputed_arange)
+        assert_almost_equal(a_dct(a_in), a_expected, decimal=6)
+
+    def test_some_ones(self):
+        """ test that dct(somevector) is computed correctly """
+        a_dct = aubio.dct(16)
+        a_in = np.ones(16).astype('float32')
+        a_in[1] = 0
+        a_in[3] = np.pi
+        a_expected = aubio.fvec(precomputed_some_ones)
+        assert_almost_equal(a_dct(a_in), a_expected, decimal=6)
+
+    def test_reconstruction(self):
+        """ test that some_ones vector can be recontructed """
+        a_dct = aubio.dct(16)
+        a_in = np.ones(16).astype('float32')
+        a_in[1] = 0
+        a_in[3] = np.pi
+        a_dct_in = a_dct(a_in)
+        a_dct_reconstructed = a_dct.rdo(a_dct_in)
+        assert_almost_equal(a_dct_reconstructed, a_in, decimal=6)
+
+    def test_negative_size(self):
+        """ test that creation fails with a negative size """
+        with self.assertRaises(ValueError):
+            aubio.dct(-1)
+
+    def test_wrong_size(self):
+        """ test that creation fails with a non power-of-two size """
+        # supports for non 2** fft sizes only when compiled with fftw3
+        size = 13
+        try:
+            with self.assertRaises(RuntimeError):
+                aubio.dct(size)
+        except AssertionError:
+            self.skipTest('creating aubio.dct with size %d did not fail' % size)
