static PyObject * Py_filter_do(Py_filter * self, PyObject * args) { PyObject *input; fvec_t *vec; if (!PyArg_ParseTuple (args, "O:digital_filter.do", &input)) { return NULL; } if (input == NULL) { return NULL; } vec = PyAubio_ArrayToCFvec (input); if (vec == NULL) { return NULL; } // compute the function fvec_t * out = new_fvec(vec->length); aubio_filter_do_outplace (self->o, vec, out); return PyAubio_CFvecToArray(out); }
/* function Py_source_do */ static PyObject * Py_source_do(Py_source * self, PyObject * args) { /* output vectors prototypes */ fvec_t* read_to; uint_t read; /* creating output read_to as a new_fvec of length self->hop_size */ read_to = new_fvec (self->hop_size); read = 0; /* compute _do function */ aubio_source_do (self->o, read_to, &read); PyObject *outputs = PyList_New(0); PyList_Append( outputs, (PyObject *)PyAubio_CFvecToArray (read_to)); //del_fvec (read_to); PyList_Append( outputs, (PyObject *)PyLong_FromLong (read)); return outputs; }
static PyObject * Py_min_removal(PyObject * self, PyObject * args) { PyObject *input; fvec_t vec; if (!PyArg_ParseTuple (args, "O:min_removal", &input)) { return NULL; } if (input == NULL) { return NULL; } if (!PyAubio_ArrayToCFvec(input, &vec)) { return NULL; } // compute the function fvec_min_removal (&vec); // since this function does not return, we could return None //Py_RETURN_NONE; // however it is convenient to return the modified vector return (PyObject *) PyAubio_CFvecToArray(&vec); // or even without converting it back to an array //Py_INCREF(vec); //return (PyObject *)vec; }
static PyObject * Py_filterbank_do(Py_filterbank * self, PyObject * args) { PyObject *input; cvec_t *vec; fvec_t *out; if (!PyArg_ParseTuple (args, "O", &input)) { return NULL; } vec = PyAubio_ArrayToCCvec (input); if (vec == NULL) { return NULL; } out = new_fvec (self->n_filters); // compute the function aubio_filterbank_do (self->o, vec, out); return (PyObject *)PyAubio_CFvecToArray(out); }