1 #include "aubio-types.h"
4 Py_aubio_window(PyObject *self, PyObject *args)
6 char_t *wintype = NULL;
10 if (!PyArg_ParseTuple (args, "|sI", &wintype, &winlen)) {
11 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
15 window = new_aubio_window(wintype, winlen);
17 PyErr_SetString (PyExc_ValueError, "failed computing window");
21 return (PyObject *) PyAubio_CFvecToArray(window);
25 Py_aubio_level_lin(PyObject *self, PyObject *args)
31 if (!PyArg_ParseTuple (args, "O:level_lin", &input)) {
32 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
40 vec = (fvec_t *)malloc(sizeof(fvec_t));
41 if (!PyAubio_ArrayToCFvec(input, vec)) {
46 level_lin = Py_BuildValue("f", aubio_level_lin(vec));
48 if (level_lin == NULL) {
49 PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
57 Py_aubio_db_spl(PyObject *self, PyObject *args)
63 if (!PyArg_ParseTuple (args, "O:db_spl", &input)) {
64 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
72 vec = (fvec_t *)malloc(sizeof(fvec_t));
73 if (!PyAubio_ArrayToCFvec(input, vec)) {
78 db_spl = Py_BuildValue("f", aubio_db_spl(vec));
81 PyErr_SetString (PyExc_ValueError, "failed computing db_spl");
89 Py_aubio_silence_detection(PyObject *self, PyObject *args)
93 PyObject *silence_detection;
96 if (!PyArg_ParseTuple (args, "Of:silence_detection", &input, &threshold)) {
97 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
105 vec = (fvec_t *)malloc(sizeof(fvec_t));
106 if (!PyAubio_ArrayToCFvec(input, vec)) {
111 silence_detection = Py_BuildValue("I", aubio_silence_detection(vec, threshold));
113 if (silence_detection == NULL) {
114 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");
118 return silence_detection;
122 Py_aubio_level_detection(PyObject *self, PyObject *args)
126 PyObject *level_detection;
129 if (!PyArg_ParseTuple (args, "Of:level_detection", &input, &threshold)) {
130 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
138 vec = (fvec_t *)malloc(sizeof(fvec_t));
139 if (!PyAubio_ArrayToCFvec(input, vec)) {
144 level_detection = Py_BuildValue("f", aubio_level_detection(vec, threshold));
146 if (level_detection == NULL) {
147 PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
151 return level_detection;