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 if (!PyAubio_ArrayToCFvec(input, &vec)) {
44 level_lin = Py_BuildValue("f", aubio_level_lin(&vec));
45 if (level_lin == NULL) {
46 PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
54 Py_aubio_db_spl(PyObject *self, PyObject *args)
60 if (!PyArg_ParseTuple (args, "O:db_spl", &input)) {
61 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
69 if (!PyAubio_ArrayToCFvec(input, &vec)) {
73 db_spl = Py_BuildValue("f", aubio_db_spl(&vec));
75 PyErr_SetString (PyExc_ValueError, "failed computing db_spl");
83 Py_aubio_silence_detection(PyObject *self, PyObject *args)
87 PyObject *silence_detection;
90 if (!PyArg_ParseTuple (args, "Of:silence_detection", &input, &threshold)) {
91 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
99 if (!PyAubio_ArrayToCFvec(input, &vec)) {
103 silence_detection = Py_BuildValue("I", aubio_silence_detection(&vec, threshold));
104 if (silence_detection == NULL) {
105 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");
109 return silence_detection;
113 Py_aubio_level_detection(PyObject *self, PyObject *args)
117 PyObject *level_detection;
120 if (!PyArg_ParseTuple (args, "Of:level_detection", &input, &threshold)) {
121 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
129 if (!PyAubio_ArrayToCFvec(input, &vec)) {
133 level_detection = Py_BuildValue("f", aubio_level_detection(&vec, threshold));
134 if (level_detection == NULL) {
135 PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
139 return level_detection;