Showing the changes to python (4 of 6 files). Show all
Unified · Split
| @@ -122,8 +122,8 @@ Py_filterbank_set_triangle_bands (Py_filterbank * self, PyObject *args) · 121 unmodified lines | |||
| 122 | uint_t err = 0; | 122 | uint_t err = 0; |
| 123 | 123 | ||
| 124 | PyObject *input; | 124 | PyObject *input; |
| 125 | uint_t samplerate; | 125 | smpl_t samplerate; |
| 126 | if (!PyArg_ParseTuple (args, "OI", &input, &samplerate)) { | 126 | if (!PyArg_ParseTuple (args, "O" AUBIO_NPY_SMPL_CHR, &input, &samplerate)) { |
| 127 | return NULL; | 127 | return NULL; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| @@ -268,9 +268,9 @@ Py_filterbank_get_coeffs (Py_filterbank * self, PyObject *unused) · 138 unmodified lines | |||
| 268 | static PyObject * | 268 | static PyObject * |
| 269 | Py_filterbank_set_power(Py_filterbank *self, PyObject *args) | 269 | Py_filterbank_set_power(Py_filterbank *self, PyObject *args) |
| 270 | { | 270 | { |
| 271 | uint_t power; | 271 | smpl_t power; |
| 272 | 272 | ||
| 273 | if (!PyArg_ParseTuple (args, "I", &power)) { | 273 | if (!PyArg_ParseTuple (args, AUBIO_NPY_SMPL_CHR, &power)) { |
| 274 | return NULL; | 274 | return NULL; |
| 275 | } | 275 | } |
| 276 | if(aubio_filterbank_set_power (self->o, power)) { | 276 | if(aubio_filterbank_set_power (self->o, power)) { |
| @@ -291,12 +291,12 @@ Py_filterbank_set_power(Py_filterbank *self, PyObject *args) · 14 unmodified lines | |||
| 291 | static PyObject * | 291 | static PyObject * |
| 292 | Py_filterbank_set_norm(Py_filterbank *self, PyObject *args) | 292 | Py_filterbank_set_norm(Py_filterbank *self, PyObject *args) |
| 293 | { | 293 | { |
| 294 | uint_t playing; | 294 | smpl_t norm; |
| 295 | 295 | ||
| 296 | if (!PyArg_ParseTuple (args, "I", &playing)) { | 296 | if (!PyArg_ParseTuple (args, AUBIO_NPY_SMPL_CHR, &norm)) { |
| 297 | return NULL; | 297 | return NULL; |
| 298 | } | 298 | } |
| 299 | if(aubio_filterbank_set_norm (self->o, playing)) { | 299 | if(aubio_filterbank_set_norm (self->o, norm)) { |
| 300 | if (PyErr_Occurred() == NULL) { | 300 | if (PyErr_Occurred() == NULL) { |
| 301 | PyErr_SetString (PyExc_ValueError, | 301 | PyErr_SetString (PyExc_ValueError, |
| 302 | "error running filterbank.set_power"); | 302 | "error running filterbank.set_power"); |
| @@ -155,7 +155,7 @@ static char Py_source_doc[] = "" · 154 unmodified lines | |||
| 155 | "... for samples in source:\n" | 155 | "... for samples in source:\n" |
| 156 | "... n_frames += len(samples)\n" | 156 | "... n_frames += len(samples)\n" |
| 157 | "... print('read', n_frames, 'samples in', samples.shape[0], 'channels',\n" | 157 | "... print('read', n_frames, 'samples in', samples.shape[0], 'channels',\n" |
| 158 | "... 'from file \"\%s\"' \% source.uri)\n" | 158 | "... 'from file \"%%s\"' %% source.uri)\n" |
| 159 | "...\n" | 159 | "...\n" |
| 160 | "read 239334 samples in 2 channels from file \"audiotrack.wav\"\n" | 160 | "read 239334 samples in 2 channels from file \"audiotrack.wav\"\n" |
| 161 | "\n" | 161 | "\n" |
| @@ -74,6 +74,18 @@ def get_preprocessor(): · 73 unmodified lines | |||
| 74 | cpp_cmd = compiler.cc.split() | 74 | cpp_cmd = compiler.cc.split() |
| 75 | cpp_cmd += ['-E'] | 75 | cpp_cmd += ['-E'] |
| 76 | 76 | ||
| 77 | # On win-amd64 (py3.x), the default compiler is cross-compiling, from x86 | ||
| 78 | # to amd64 with %WIN_SDK_ROOT%\x86_amd64\cl.exe, but using this binary as a | ||
| 79 | # pre-processor generates no output, so we use %WIN_SDK_ROOT%\cl.exe | ||
| 80 | # instead. | ||
| 81 | if len(cpp_cmd) > 1 and 'cl.exe' in cpp_cmd[-2]: | ||
| 82 | plat = os.path.basename(os.path.dirname(cpp_cmd[-2])) | ||
| 83 | if plat == 'x86_amd64': | ||
| 84 | print('workaround on win64 to avoid empty pre-processor output') | ||
| 85 | cpp_cmd[-2] = cpp_cmd[-2].replace('x86_amd64', '') | ||
| 86 | elif True in ['amd64' in f for f in cpp_cmd]: | ||
| 87 | print('warning: not using workaround for', cpp_cmd[0], plat) | ||
| 88 | |||
| 77 | if not cpp_cmd: | 89 | if not cpp_cmd: |
| 78 | print("Warning: could not guess preprocessor, using env's CC") | 90 | print("Warning: could not guess preprocessor, using env's CC") |
| 79 | cpp_cmd = os.environ.get('CC', 'cc').split() | 91 | cpp_cmd = os.environ.get('CC', 'cc').split() |
| @@ -135,7 +135,7 @@ class aubio_mfcc_fb_params(TestCase): · 134 unmodified lines | |||
| 135 | def test_set_mel_coeffs_slaney(self): | 135 | def test_set_mel_coeffs_slaney(self): |
| 136 | buf_size, n_filters, n_coeffs, samplerate = 512, 40, 10, 16000 | 136 | buf_size, n_filters, n_coeffs, samplerate = 512, 40, 10, 16000 |
| 137 | m = mfcc(buf_size, n_filters, n_coeffs, samplerate) | 137 | m = mfcc(buf_size, n_filters, n_coeffs, samplerate) |
| 138 | m.set_mel_coeffs_slaney(samplerate) | 138 | m.set_mel_coeffs_slaney() |
| 139 | m(cvec(buf_size)) | 139 | m(cvec(buf_size)) |
| 140 | assert m.get_power() == 1 | 140 | assert m.get_power() == 1 |
| 141 | assert m.get_scale() == 1 | 141 | assert m.get_scale() == 1 |