- Timestamp:
- Jul 10, 2015, 12:59:23 AM (10 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:
- 5a7e2c3
- Parents:
- 5e394ecc
- Location:
- python
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-musicutils.c
r5e394ecc refa62ce 4 4 Py_aubio_window(PyObject *self, PyObject *args) 5 5 { 6 PyObject *output = NULL;7 6 char_t *wintype = NULL; 8 7 uint_t winlen = 0; 9 fvec_t *window ;8 fvec_t *window = NULL; 10 9 11 if (!PyArg_ParseTuple (args, "|sd", &wintype, &winlen)) { 12 PyErr_SetString (PyExc_ValueError, 13 "failed parsing arguments"); 10 if (!PyArg_ParseTuple (args, "|sI", &wintype, &winlen)) { 11 PyErr_SetString (PyExc_ValueError, "failed parsing arguments"); 14 12 return NULL; 15 13 } 16 14 17 //return (PyObject *) PyAubio_CFvecToArray(vec); 18 Py_RETURN_NONE; 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); 19 22 } -
python/ext/py-musicutils.h
r5e394ecc refa62ce 10 10 "-------\n" 11 11 "\n" 12 ">>> window('hanningz', 1024)"; 12 ">>> window('hanningz', 1024)\n" 13 "array([ 0.00000000e+00, 9.41753387e-06, 3.76403332e-05, ...,\n" 14 " 8.46982002e-05, 3.76403332e-05, 9.41753387e-06], dtype=float32)"; 13 15 14 16 PyObject * Py_aubio_window(PyObject *self, PyObject *args); -
python/tests/test_musicutils.py
r5e394ecc refa62ce 2 2 3 3 from numpy.testing import TestCase 4 from numpy.testing.utils import assert_almost_equal 4 5 from aubio import window 5 6 … … 25 26 self.fail('non-integer window length does not raise a ValueError') 26 27 28 def test_compute_hanning_1024(self): 29 from numpy import cos, arange 30 from math import pi 31 size = 1024 32 aubio_window = window("hanning", size) 33 numpy_window = .5 - .5 * cos(2. * pi * arange(size) / size) 34 assert_almost_equal(aubio_window, numpy_window) 35 27 36 if __name__ == '__main__': 28 37 from unittest import main
Note: See TracChangeset
for help on using the changeset viewer.