Showing the changes to python (5 of 5 files). Show all
Unified · Split
| @@ -1,6 +1,7 @@ | |||
| 1 | #define PY_AUBIO_MODULE_MAIN | 1 | #define PY_AUBIO_MODULE_MAIN |
| 2 | #include "aubio-types.h" | 2 | #include "aubio-types.h" |
| 3 | #include "aubio-generated.h" | 3 | #include "aubio-generated.h" |
| 4 | #include "py-musicutils.h" | ||
| 4 | 5 | ||
| 5 | static char aubio_module_doc[] = "Python module for the aubio library"; | 6 | static char aubio_module_doc[] = "Python module for the aubio library"; |
| 6 | 7 | ||
| @@ -239,6 +240,7 @@ static PyMethodDef aubio_methods[] = { · 232 unmodified lines | |||
| 239 | {"alpha_norm", Py_alpha_norm, METH_VARARGS, Py_alpha_norm_doc}, | 240 | {"alpha_norm", Py_alpha_norm, METH_VARARGS, Py_alpha_norm_doc}, |
| 240 | {"zero_crossing_rate", Py_zero_crossing_rate, METH_VARARGS, Py_zero_crossing_rate_doc}, | 241 | {"zero_crossing_rate", Py_zero_crossing_rate, METH_VARARGS, Py_zero_crossing_rate_doc}, |
| 241 | {"min_removal", Py_min_removal, METH_VARARGS, Py_min_removal_doc}, | 242 | {"min_removal", Py_min_removal, METH_VARARGS, Py_min_removal_doc}, |
| 243 | {"window", Py_aubio_window, METH_VARARGS, Py_aubio_window_doc}, | ||
| 242 | {NULL, NULL} /* Sentinel */ | 244 | {NULL, NULL} /* Sentinel */ |
| 243 | }; | 245 | }; |
| 244 | 246 | ||
| @@ -0,0 +1,19 @@ | |||
| 1 | #include "aubio-types.h" | ||
| 2 | |||
| 3 | PyObject * | ||
| 4 | Py_aubio_window(PyObject *self, PyObject *args) | ||
| 5 | { | ||
| 6 | PyObject *output = NULL; | ||
| 7 | char_t *wintype = NULL; | ||
| 8 | uint_t winlen = 0; | ||
| 9 | fvec_t *window; | ||
| 10 | |||
| 11 | if (!PyArg_ParseTuple (args, "|sd", &wintype, &winlen)) { | ||
| 12 | PyErr_SetString (PyExc_ValueError, | ||
| 13 | "failed parsing arguments"); | ||
| 14 | return NULL; | ||
| 15 | } | ||
| 16 | |||
| 17 | //return (PyObject *) PyAubio_CFvecToArray(vec); | ||
| 18 | Py_RETURN_NONE; | ||
| 19 | } | ||
| @@ -0,0 +1,16 @@ | |||
| 1 | #ifndef _PY_AUBIO_MUSICUTILS_H_ | ||
| 2 | #define _PY_AUBIO_MUSICUTILS_H_ | ||
| 3 | |||
| 4 | static char Py_aubio_window_doc[] = "" | ||
| 5 | "window(string, integer) -> fvec\n" | ||
| 6 | "\n" | ||
| 7 | "Create a window\n" | ||
| 8 | "\n" | ||
| 9 | "Example\n" | ||
| 10 | "-------\n" | ||
| 11 | "\n" | ||
| 12 | ">>> window('hanningz', 1024)"; | ||
| 13 | |||
| 14 | PyObject * Py_aubio_window(PyObject *self, PyObject *args); | ||
| 15 | |||
| 16 | #endif /* _PY_AUBIO_MUSICUTILS_H_ */ | ||
| @@ -46,6 +46,7 @@ aubio_extension = Extension("aubio._aubio", [ · 45 unmodified lines | |||
| 46 | "ext/aubiomodule.c", | 46 | "ext/aubiomodule.c", |
| 47 | "ext/aubioproxy.c", | 47 | "ext/aubioproxy.c", |
| 48 | "ext/ufuncs.c", | 48 | "ext/ufuncs.c", |
| 49 | "ext/py-musicutils.c", | ||
| 49 | "ext/py-cvec.c", | 50 | "ext/py-cvec.c", |
| 50 | # example without macro | 51 | # example without macro |
| 51 | "ext/py-filter.c", | 52 | "ext/py-filter.c", |
| @@ -0,0 +1,13 @@ | |||
| 1 | #! /usr/bin/env python | ||
| 2 | |||
| 3 | from numpy.testing import TestCase | ||
| 4 | from aubio import window | ||
| 5 | |||
| 6 | class aubio_window(TestCase): | ||
| 7 | |||
| 8 | def test_accept_name_and_size(self): | ||
| 9 | window("default", 1024) | ||
| 10 | |||
| 11 | if __name__ == '__main__': | ||
| 12 | from unittest import main | ||
| 13 | main() | ||