Index: python/lib/gen_code.py
===================================================================
--- python/lib/gen_code.py	(revision ccb9fb565a315f676cd028cde7fa2da4ac26879f)
+++ python/lib/gen_code.py	(revision 82cdc9712b10b3e99894bb40c0c21a486e071e0e)
@@ -39,5 +39,5 @@
         'fvec_t*': 'PyAubio_ArrayToCFvec',
         'cvec_t*': 'PyAubio_ArrayToCCvec',
-        'fmat_t*': 'PyAubio_ArrayToCFmat',
+        #'fmat_t*': 'PyAubio_ArrayToCFmat',
         }
 
@@ -75,4 +75,5 @@
         'fmat_t*': 'O',
         'fvec_t*': 'O',
+        'cvec_t*': 'O',
         }
 
@@ -84,6 +85,7 @@
         'mfcc': 'self->n_coeffs',
         'specdesc': '1',
-        'tempo': '1',
+        'tempo': '2',
         'filterbank': 'self->n_filters',
+        'tss': 'self->hop_size',
         }
 
@@ -105,18 +107,18 @@
         return ['foo*', 'name'] """
     l = arg.split()
-    type_arg = {'type': l[0], 'name': l[1]}
-    # ['foo', '*name'] -> ['foo*', 'name']
-    if l[-1].startswith('*'):
-        #return [l[0]+'*', l[1][1:]]
-        type_arg['type'] = l[0] + '*'
-        type_arg['name'] = l[1][1:]
-    # ['foo', '*', 'name'] -> ['foo*', 'name']
-    if len(l) == 3:
-        #return [l[0]+l[1], l[2]]
-        type_arg['type'] = l[0]+l[1]
-        type_arg['name'] = l[2]
-    else:
-        #return l
-        pass
+    type_arg = {} #'type': l[0], 'name': l[1]}
+    type_arg['type'] = " ".join(l[:-1])
+    type_arg['name'] = l[-1]
+    # fix up type / name
+    if type_arg['name'].startswith('*'):
+        # ['foo', '*name'] -> ['foo*', 'name']
+        type_arg['type'] += '*'
+        type_arg['name'] = type_arg['name'][1:]
+    if type_arg['type'].endswith(' *'):
+        # ['foo *', 'name'] -> ['foo*', 'name']
+        type_arg['type'] = type_arg['type'].replace(' *','*')
+    if type_arg['type'].startswith('const '):
+        # ['foo *', 'name'] -> ['foo*', 'name']
+        type_arg['type'] = type_arg['type'].replace('const ','')
     return type_arg
 
@@ -127,6 +129,16 @@
     """
     import re
-    paramregex = re.compile('[\(, ](\w+ \*?\*? ?\w+)[, \)]')
-    return paramregex.findall(proto)
+    paramregex = re.compile('.*\((.*)\);')
+    a = paramregex.findall(proto)[0].split(', ')
+    #a = [i.replace('const ', '') for i in a]
+    return a
+
+def get_input_params(proto):
+    a = get_params(proto)
+    return [i.replace('const ', '') for i in a if (i.startswith('const ') or i.startswith('uint_t ') or i.startswith('smpl_t '))]
+
+def get_output_params(proto):
+    a = get_params(proto)
+    return [i for i in a if not i.startswith('const ')][1:]
 
 def get_params_types_names(proto):
@@ -135,6 +147,8 @@
     returns: [['int', 'argc'], ['char **','argv']]
     """
-    return list(map(split_type, get_params(proto)))
-
+    a = list(map(split_type, get_params(proto)))
+    #print proto, a
+    #import sys; sys.exit(1)
+    return a
 
 class MappedObject(object):
@@ -149,8 +163,13 @@
         self.do_proto = prototypes['do'][0]
         self.input_params = get_params_types_names(self.new_proto)
-        self.input_params_list = "; ".join(get_params(self.new_proto))
+        self.input_params_list = "; ".join(get_input_params(self.new_proto))
         self.outputs = get_params_types_names(self.do_proto)[2:]
-        self.outputs_flat = get_params(self.do_proto)[2:]
-        self.output_results = ", ".join(self.outputs_flat)
+        self.do_inputs = [get_params_types_names(self.do_proto)[1]]
+        self.do_outputs = get_params_types_names(self.do_proto)[2:]
+        self.outputs_flat = get_output_params(self.do_proto)
+        self.output_results = "; ".join(self.outputs_flat)
+
+        print "input_params", map(split_type, get_input_params(self.do_proto))
+        print "output_params", map(split_type, get_output_params(self.do_proto))
 
     def gen_code(self):
@@ -178,9 +197,11 @@
     // input parameters
     {input_params_list};
+    // do input vectors
+    {do_inputs_list};
     // output results
     {output_results};
 }} Py_{shortname};
 """
-        return out.format(**self.__dict__)
+        return out.format(do_inputs_list = "; ".join(get_input_params(self.do_proto)), **self.__dict__)
 
     def gen_doc(self):
@@ -188,5 +209,5 @@
 // TODO: add documentation
 static char Py_{shortname}_doc[] = \"undefined\";
-    """
+"""
         return out.format(**self.__dict__)
 
@@ -222,5 +243,5 @@
         params = self.input_params
         for p in params:
-            out += self.check_valid(p) 
+            out += self.check_valid(p)
         out += """
     return (PyObject *)self;
@@ -290,4 +311,7 @@
   // TODO get internal params after actual object creation?
 """
+        for input_param in self.do_inputs:
+            out += """
+  self->{0} = ({1})malloc(sizeof({2}));""".format(input_param['name'], input_param['type'], input_param['type'][:-1])
         out += """
   // create outputs{output_create}
@@ -318,4 +342,7 @@
 Py_{shortname}_del  (Py_{shortname} * self, PyObject * unused)
 {{""".format(**self.__dict__)
+        for input_param in self.do_inputs:
+            out += """
+    free(self->{0[name]});""".format(input_param)
         for o in self.outputs:
             name = o['name']
@@ -332,7 +359,4 @@
 
     def gen_do(self):
-        do_fn = get_name(self.do_proto)
-        input_param = get_params_types_names(self.do_proto)[1];
-        pytoaubio = pytoaubio_fn[input_param['type']]
         output = self.outputs[0]
         out = """
@@ -340,29 +364,38 @@
 static PyObject*
 Py_{shortname}_do  (Py_{shortname} * self, PyObject * args)
-{{
-    PyObject * in_obj;
-    {input_type} {input_name};
-
-    if (!PyArg_ParseTuple (args, "O", &in_obj)) {{
+{{""".format(**self.__dict__)
+        input_params = self.do_inputs
+        output_params = self.do_outputs
+        #print input_params
+        #print output_params
+        for input_param in input_params:
+            out += """
+    PyObject *py_{0};""".format(input_param['name'], input_param['type'])
+        refs = ", ".join(["&py_%s" % p['name'] for p in input_params])
+        pyparamtypes = "".join([pyargparse_chars[p['type']] for p in input_params])
+        out += """
+    if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{
         return NULL;
-    }}
-    {input_name} = {pytoaubio} (in_obj); 
-    if ({input_name} == NULL) {{
+    }}""".format(refs = refs, pyparamtypes = pyparamtypes, **self.__dict__)
+        for p in input_params:
+            out += """
+    if (!{pytoaubio}(py_{0[name]}, self->{0[name]})) {{
         return NULL;
-    }}
-
-    {do_fn}(self->o, {input_name}, {outputs});
+    }}""".format(input_param, pytoaubio = pytoaubio_fn[input_param['type']])
+        do_fn = get_name(self.do_proto)
+        inputs = ", ".join(['self->'+p['name'] for p in input_params])
+        outputs = ", ".join(["self->%s" % p['name'] for p in self.do_outputs])
+        out += """
+
+    {do_fn}(self->o, {inputs}, {outputs});
 
     return (PyObject *) {aubiotonumpy} ({outputs});
 }}
-"""
-        return out.format(do_fn = do_fn,
-                shortname = self.prototypes['shortname'],
-                input_name = input_param['name'],
-                input_type= input_param['type'],
-                pytoaubio = pytoaubio,
-                outputs = ", ".join(["self->%s" % p['name'] for p in self.outputs]),
-                aubiotonumpy = pyfromaubio_fn[output['type']], 
-                )
+""".format(
+        do_fn = do_fn,
+        aubiotonumpy = pyfromaubio_fn[output['type']], 
+        inputs = inputs, outputs = outputs,
+        )
+        return out
 
     def gen_set(self):
Index: python/lib/gen_external.py
===================================================================
--- python/lib/gen_external.py	(revision ccb9fb565a315f676cd028cde7fa2da4ac26879f)
+++ python/lib/gen_external.py	(revision 82cdc9712b10b3e99894bb40c0c21a486e071e0e)
@@ -117,5 +117,5 @@
             elif len(lib[o][family]) == 1:
                 print ( "{:15s} {:10s} {:s}".format(o, family, lib[o][family][0] ) )
-            else:                                             
+            else:
                 print ( "{:15s} {:10s} {:d}".format(o, family, len(lib[o][family]) ) )
     """
@@ -159,5 +159,5 @@
         print ("wrote %s" % output_file )
         sources_list.append(output_file)
-    
+
     objlist = "".join(["extern PyTypeObject Py_%sType;\n" % p for p in lib])
     out = """
