1 #include "aubiowraphell.h"
3 static char Py_fft_doc[] = "fft object";
5 AUBIO_DECLARE(fft, uint_t win_s)
9 Py_fft_new (PyTypeObject * type, PyObject * args, PyObject * kwds)
13 static char *kwlist[] = { "win_s", NULL };
15 if (!PyArg_ParseTupleAndKeywords (args, kwds, "|I", kwlist,
20 self = (Py_fft *) type->tp_alloc (type, 0);
26 self->win_s = Py_default_vector_length;
34 } else if (win_s < 0) {
35 PyErr_SetString (PyExc_ValueError,
36 "can not use negative window size");
40 return (PyObject *) self;
44 AUBIO_INIT(fft, self->win_s)
49 Py_fft_do(PyObject * self, PyObject * args)
55 if (!PyArg_ParseTuple (args, "O", &input)) {
59 vec = PyAubio_ArrayToCFvec (input);
65 output = new_cvec(((Py_fft *) self)->win_s);
67 // compute the function
68 aubio_fft_do (((Py_fft *)self)->o, vec, output);
69 return (PyObject *)PyAubio_CCvecToPyCvec(output);
72 AUBIO_MEMBERS_START(fft)
73 {"win_s", T_INT, offsetof (Py_fft, win_s), READONLY,
74 "size of the window"},
75 AUBIO_MEMBERS_STOP(fft)
78 Py_fft_rdo(Py_fft * self, PyObject * args)
84 if (!PyArg_ParseTuple (args, "O", &input)) {
88 vec = PyAubio_ArrayToCCvec (input);
94 output = new_fvec(self->win_s);
96 // compute the function
97 aubio_fft_rdo (((Py_fft *)self)->o, vec, output);
98 return (PyObject *)PyAubio_CFvecToArray(output);
101 static PyMethodDef Py_fft_methods[] = {
102 {"rdo", (PyCFunction) Py_fft_rdo, METH_VARARGS,
103 "synthesis of spectral grain"},
107 AUBIO_TYPEOBJECT(fft, "aubio.fft")