History

Merge branch 'master' into feature/pytest

Paul Brossier committed 7 years ago

Commit 74c1fb92 parents c1ba75b fda339442 files · +900 −1139Browse files

Showing the changes to python (4 of 42 files). Show all

Unified · Split

4 files
  1. python/README.md +1 −1
  2. python/ext/aubiomodule.c +2 −2
  3. python/ext/py-cvec.c +1 −1
  4. python/ext/py-musicutils.c +10 −10
python/README.md+1−1
@@ -27,7 +27,7 @@ Links · 26 unmodified lines
2727 Demos
2828 -----
2929
30−Some examples are available in the [`python/demos`][demos_dir] folder. Each
30+Some examples are available in the [`python/demos` folder][demos_dir]. Each
3131 script is a command line program which accepts one ore more argument.
3232
3333 **Notes**: installing additional modules is required to run some of the demos.
python/ext/aubiomodule.c+2−2
@@ -223,7 +223,7 @@ Py_alpha_norm (PyObject * self, PyObject * args) · 222 unmodified lines
223223 }
224224
225225 // compute the function
226− result = Py_BuildValue (AUBIO_NPY_SMPL_CHR, fvec_alpha_norm (&vec, alpha));
226+ result = PyFloat_FromDouble(fvec_alpha_norm (&vec, alpha));
227227 if (result == NULL) {
228228 return NULL;
229229 }
@@ -319,7 +319,7 @@ Py_zero_crossing_rate (PyObject * self, PyObject * args) · 89 unmodified lines
319319 }
320320
321321 // compute the function
322− result = Py_BuildValue (AUBIO_NPY_SMPL_CHR, aubio_zero_crossing_rate (&vec));
322+ result = PyFloat_FromDouble(aubio_zero_crossing_rate (&vec));
323323 if (result == NULL) {
324324 return NULL;
325325 }
python/ext/py-cvec.c+1−1
@@ -136,7 +136,7 @@ Py_cvec_repr (Py_cvec * self, PyObject * unused) · 135 unmodified lines
136136 goto fail;
137137 }
138138
139− args = Py_BuildValue ("I", self->length);
139+ args = PyLong_FromLong(self->length);
140140 if (args == NULL) {
141141 goto fail;
142142 }
python/ext/py-musicutils.c+10−10
@@ -39,7 +39,7 @@ Py_aubio_level_lin(PyObject *self, PyObject *args) · 38 unmodified lines
3939 return NULL;
4040 }
4141
42− level_lin = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_lin(&vec));
42+ level_lin = PyFloat_FromDouble(aubio_level_lin(&vec));
4343 if (level_lin == NULL) {
4444 PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
4545 return NULL;
@@ -67,7 +67,7 @@ Py_aubio_db_spl(PyObject *self, PyObject *args) · 21 unmodified lines
6767 return NULL;
6868 }
6969
70− db_spl = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_db_spl(&vec));
70+ db_spl = PyFloat_FromDouble(aubio_db_spl(&vec));
7171 if (db_spl == NULL) {
7272 PyErr_SetString (PyExc_ValueError, "failed computing db_spl");
7373 return NULL;
@@ -96,7 +96,7 @@ Py_aubio_silence_detection(PyObject *self, PyObject *args) · 22 unmodified lines
9696 return NULL;
9797 }
9898
99− silence_detection = Py_BuildValue("I", aubio_silence_detection(&vec, threshold));
99+ silence_detection = PyLong_FromLong(aubio_silence_detection(&vec, threshold));
100100 if (silence_detection == NULL) {
101101 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");
102102 return NULL;
@@ -125,7 +125,7 @@ Py_aubio_level_detection(PyObject *self, PyObject *args) · 22 unmodified lines
125125 return NULL;
126126 }
127127
128− level_detection = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_detection(&vec, threshold));
128+ level_detection = PyFloat_FromDouble(aubio_level_detection(&vec, threshold));
129129 if (level_detection == NULL) {
130130 PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
131131 return NULL;
@@ -194,9 +194,9 @@ Py_aubio_hztomel(PyObject *self, PyObject *args, PyObject *kwds) · 62 unmodified lines
194194 return NULL;
195195 }
196196 if (htk != NULL && PyObject_IsTrue(htk) == 1)
197− return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_hztomel_htk(v));
197+ return PyFloat_FromDouble(aubio_hztomel_htk(v));
198198 else
199− return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_hztomel(v));
199+ return PyFloat_FromDouble(aubio_hztomel(v));
200200 }
201201
202202 PyObject*
@@ -211,9 +211,9 @@ Py_aubio_meltohz(PyObject *self, PyObject *args, PyObject *kwds) · 8 unmodified lines
211211 return NULL;
212212 }
213213 if (htk != NULL && PyObject_IsTrue(htk) == 1)
214− return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_meltohz_htk(v));
214+ return PyFloat_FromDouble(aubio_meltohz_htk(v));
215215 else
216− return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_meltohz(v));
216+ return PyFloat_FromDouble(aubio_meltohz(v));
217217 }
218218
219219 PyObject*
@@ -223,7 +223,7 @@ Py_aubio_hztomel_htk(PyObject *self, PyObject *args) · 3 unmodified lines
223223 if (!PyArg_ParseTuple(args, AUBIO_NPY_SMPL_CHR, &v)) {
224224 return NULL;
225225 }
226− return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_hztomel_htk(v));
226+ return PyFloat_FromDouble(aubio_hztomel_htk(v));
227227 }
228228
229229 PyObject*
@@ -233,5 +233,5 @@ Py_aubio_meltohz_htk(PyObject *self, PyObject *args) · 3 unmodified lines
233233 if (!PyArg_ParseTuple(args, AUBIO_NPY_SMPL_CHR, &v)) {
234234 return NULL;
235235 }
236− return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_meltohz_htk(v));
236+ return PyFloat_FromDouble(aubio_meltohz_htk(v));
237237 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t