Changeset 451b05d
- Timestamp:
- Jul 11, 2012, 5:25:25 AM (13 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- b84c0c2
- Parents:
- c71e405 (diff), 0ed517b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- interfaces/python
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/aubio-types.h
rc71e405 r451b05d 2 2 #include <structmember.h> 3 3 #define NO_IMPORT_ARRAY 4 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 4 5 #include <numpy/arrayobject.h> 5 6 #define AUBIO_UNSTABLE 1 -
interfaces/python/aubiomodule.c
rc71e405 r451b05d 1 1 #include <Python.h> 2 2 #define PY_ARRAY_UNIQUE_SYMBOL PyArray_API 3 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 3 4 #include <numpy/arrayobject.h> 4 5 … … 132 133 } 133 134 135 m = Py_InitModule3 ("_aubio", aubio_methods, aubio_module_doc); 136 137 if (m == NULL) { 138 return; 139 } 140 134 141 err = _import_array (); 135 142 … … 137 144 fprintf (stderr, 138 145 "Unable to import Numpy C API from aubio module (error %d)\n", err); 139 }140 141 m = Py_InitModule3 ("_aubio", aubio_methods, aubio_module_doc);142 143 if (m == NULL) {144 return;145 146 } 146 147 -
interfaces/python/aubioproxy.c
rc71e405 r451b05d 13 13 14 14 // we got an array, convert it to an fvec 15 if (PyArray_NDIM ( input) == 0) {15 if (PyArray_NDIM ((PyArrayObject *)input) == 0) { 16 16 PyErr_SetString (PyExc_ValueError, "input array is a scalar"); 17 17 goto fail; 18 } else if (PyArray_NDIM ( input) > 1) {18 } else if (PyArray_NDIM ((PyArrayObject *)input) > 1) { 19 19 PyErr_SetString (PyExc_ValueError, 20 20 "input array has more than one dimensions"); … … 22 22 } 23 23 24 if (!PyArray_ISFLOAT ( input)) {24 if (!PyArray_ISFLOAT ((PyArrayObject *)input)) { 25 25 PyErr_SetString (PyExc_ValueError, "input array should be float"); 26 26 goto fail; 27 } else if (PyArray_TYPE ( input) != AUBIO_NPY_SMPL) {27 } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) { 28 28 PyErr_SetString (PyExc_ValueError, "input array should be float32"); 29 29 goto fail; … … 36 36 // no need to really allocate fvec, just its struct member 37 37 vec = (fvec_t *)malloc(sizeof(fvec_t)); 38 vec->length = PyArray_SIZE ( array);39 vec->data = (smpl_t *) PyArray_GETPTR1 ( array, 0);38 vec->length = PyArray_SIZE ((PyArrayObject *)array); 39 vec->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)array, 0); 40 40 41 41 } else if (PyObject_TypeCheck (input, &PyList_Type)) { -
interfaces/python/demo_filterbank.py
rc71e405 r451b05d 4 4 freq_list = [60, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 15000, 24000] 5 5 freqs = fvec(freq_list) 6 f.set_triangle_bands(freq _list, 48000)6 f.set_triangle_bands(freqs, 48000) 7 7 f.get_coeffs().T 8 8 -
interfaces/python/py-cvec.c
rc71e405 r451b05d 126 126 Py_cvec_set_norm (Py_cvec * vec, PyObject *input, void * closure) 127 127 { 128 Py Object * array;128 PyArrayObject * array; 129 129 if (input == NULL) { 130 130 PyErr_SetString (PyExc_ValueError, "input array is not a python object"); … … 134 134 135 135 // we got an array, convert it to a cvec.norm 136 if (PyArray_NDIM ( input) == 0) {136 if (PyArray_NDIM ((PyArrayObject *)input) == 0) { 137 137 PyErr_SetString (PyExc_ValueError, "input array is a scalar"); 138 138 goto fail; 139 } else if (PyArray_NDIM ( input) > 2) {139 } else if (PyArray_NDIM ((PyArrayObject *)input) > 2) { 140 140 PyErr_SetString (PyExc_ValueError, 141 141 "input array has more than two dimensions"); … … 143 143 } 144 144 145 if (!PyArray_ISFLOAT ( input)) {145 if (!PyArray_ISFLOAT ((PyArrayObject *)input)) { 146 146 PyErr_SetString (PyExc_ValueError, "input array should be float"); 147 147 goto fail; 148 } else if (PyArray_TYPE ( input) != AUBIO_NPY_SMPL) {148 } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) { 149 149 PyErr_SetString (PyExc_ValueError, "input array should be float32"); 150 150 goto fail; 151 151 } 152 array = input;152 array = (PyArrayObject *)input; 153 153 154 154 // check input array dimensions … … 162 162 PyErr_Format (PyExc_ValueError, 163 163 "input array has length %d, but cvec has length %d", 164 PyArray_SIZE (array), vec->o->length);164 (int)PyArray_SIZE (array), vec->o->length); 165 165 goto fail; 166 166 } … … 184 184 Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure) 185 185 { 186 Py Object * array;186 PyArrayObject * array; 187 187 if (input == NULL) { 188 188 PyErr_SetString (PyExc_ValueError, "input array is not a python object"); … … 192 192 193 193 // we got an array, convert it to a cvec.phas 194 if (PyArray_NDIM ( input) == 0) {194 if (PyArray_NDIM ((PyArrayObject *)input) == 0) { 195 195 PyErr_SetString (PyExc_ValueError, "input array is a scalar"); 196 196 goto fail; 197 } else if (PyArray_NDIM ( input) > 2) {197 } else if (PyArray_NDIM ((PyArrayObject *)input) > 2) { 198 198 PyErr_SetString (PyExc_ValueError, 199 199 "input array has more than two dimensions"); … … 201 201 } 202 202 203 if (!PyArray_ISFLOAT ( input)) {203 if (!PyArray_ISFLOAT ((PyArrayObject *)input)) { 204 204 PyErr_SetString (PyExc_ValueError, "input array should be float"); 205 205 goto fail; 206 } else if (PyArray_TYPE ( input) != AUBIO_NPY_SMPL) {206 } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) { 207 207 PyErr_SetString (PyExc_ValueError, "input array should be float32"); 208 208 goto fail; 209 209 } 210 array = input;210 array = (PyArrayObject *)input; 211 211 212 212 // check input array dimensions … … 220 220 PyErr_Format (PyExc_ValueError, 221 221 "input array has length %d, but cvec has length %d", 222 PyArray_SIZE (array), vec->o->length);222 (int)PyArray_SIZE (array), vec->o->length); 223 223 goto fail; 224 224 } -
interfaces/python/setup.py
rc71e405 r451b05d 5 5 from generator import generate_object_files 6 6 7 setup(name="_aubio", version="1.0", 7 setup(name='aubio', 8 version = '0.4.0alpha', 8 9 packages = ['aubio'], 10 description = 'interface to the aubio library', 11 long_description = 'interface to the aubio library', 12 license = 'GNU/GPL version 3', 13 author = 'Paul Brossier', 14 author_email = 'piem@aubio.org', 15 maintainer = 'Paul Brossier', 16 maintainer_email = 'piem@aubio.org', 17 url = 'http://aubio.org/', 9 18 ext_modules = [ 10 19 Extension("_aubio",
Note: See TracChangeset
for help on using the changeset viewer.