feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 5a7e2c3 was
5a7e2c3,
checked in by Paul Brossier <piem@piem.org>, 9 years ago
|
ext/py-musicutils.c: add level_lin
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[913a7f1] | 1 | #include "aubio-types.h" |
---|
| 2 | |
---|
| 3 | PyObject * |
---|
| 4 | Py_aubio_window(PyObject *self, PyObject *args) |
---|
| 5 | { |
---|
| 6 | char_t *wintype = NULL; |
---|
| 7 | uint_t winlen = 0; |
---|
[efa62ce] | 8 | fvec_t *window = NULL; |
---|
[913a7f1] | 9 | |
---|
[efa62ce] | 10 | if (!PyArg_ParseTuple (args, "|sI", &wintype, &winlen)) { |
---|
| 11 | PyErr_SetString (PyExc_ValueError, "failed parsing arguments"); |
---|
[913a7f1] | 12 | return NULL; |
---|
| 13 | } |
---|
| 14 | |
---|
[efa62ce] | 15 | window = new_aubio_window(wintype, winlen); |
---|
| 16 | if (window == NULL) { |
---|
| 17 | PyErr_SetString (PyExc_ValueError, "failed computing window"); |
---|
| 18 | return NULL; |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | return (PyObject *) PyAubio_CFvecToArray(window); |
---|
[913a7f1] | 22 | } |
---|
[5a7e2c3] | 23 | |
---|
| 24 | PyObject * |
---|
| 25 | Py_aubio_level_lin(PyObject *self, PyObject *args) |
---|
| 26 | { |
---|
| 27 | PyObject *input; |
---|
| 28 | fvec_t *vec; |
---|
| 29 | PyObject *level_lin; |
---|
| 30 | |
---|
| 31 | if (!PyArg_ParseTuple (args, "O:level_lin", &input)) { |
---|
| 32 | PyErr_SetString (PyExc_ValueError, "failed parsing arguments"); |
---|
| 33 | return NULL; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | if (input == NULL) { |
---|
| 37 | return NULL; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | vec = PyAubio_ArrayToCFvec (input); |
---|
| 41 | if (vec == NULL) { |
---|
| 42 | return NULL; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | level_lin = Py_BuildValue("f", aubio_level_lin(vec)); |
---|
| 46 | if (level_lin == NULL) { |
---|
| 47 | PyErr_SetString (PyExc_ValueError, "failed computing level_lin"); |
---|
| 48 | return NULL; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | return level_lin; |
---|
| 52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.