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 = PyAubio_ArrayToCFvec (input);
45 level_lin = Py_BuildValue("f", aubio_level_lin(vec));
46 if (level_lin == NULL) {
47 PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
55 Py_aubio_db_spl(PyObject *self, PyObject *args)
61 if (!PyArg_ParseTuple (args, "O:db_spl", &input)) {
62 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
70 vec = PyAubio_ArrayToCFvec (input);
75 db_spl = Py_BuildValue("f", aubio_db_spl(vec));
77 PyErr_SetString (PyExc_ValueError, "failed computing db_spl");
85 Py_aubio_silence_detection(PyObject *self, PyObject *args)
89 PyObject *silence_detection;
92 if (!PyArg_ParseTuple (args, "Of:silence_detection", &input, &threshold)) {
93 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
101 vec = PyAubio_ArrayToCFvec (input);
106 silence_detection = Py_BuildValue("I", aubio_silence_detection(vec, threshold));
107 if (silence_detection == NULL) {
108 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");
112 return silence_detection;
116 Py_aubio_level_detection(PyObject *self, PyObject *args)
120 PyObject *level_detection;
123 if (!PyArg_ParseTuple (args, "Of:level_detection", &input, &threshold)) {
124 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
132 vec = PyAubio_ArrayToCFvec (input);
137 level_detection = Py_BuildValue("f", aubio_level_detection(vec, threshold));
138 if (level_detection == NULL) {
139 PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
143 return level_detection;