Changeset 5a7e2c3 for python/ext


Ignore:
Timestamp:
Jul 10, 2015, 1:51:25 AM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
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:
4615886a
Parents:
efa62ce
Message:

ext/py-musicutils.c: add level_lin

Location:
python/ext
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/ext/aubiomodule.c

    refa62ce r5a7e2c3  
    241241  {"zero_crossing_rate", Py_zero_crossing_rate, METH_VARARGS, Py_zero_crossing_rate_doc},
    242242  {"min_removal", Py_min_removal, METH_VARARGS, Py_min_removal_doc},
     243  {"level_lin", Py_aubio_level_lin, METH_VARARGS, Py_aubio_level_lin_doc},
    243244  {"window", Py_aubio_window, METH_VARARGS, Py_aubio_window_doc},
    244245  {NULL, NULL} /* Sentinel */
  • python/ext/py-musicutils.c

    refa62ce r5a7e2c3  
    2121  return (PyObject *) PyAubio_CFvecToArray(window);
    2222}
     23
     24PyObject *
     25Py_aubio_level_lin(PyObject *self, PyObject *args)
     26{
     27  PyObject *input;
     28  fvec_t *vec;
     29  PyObject *level_lin;
     30
     31  if (!PyArg_ParseTuple (args, "O:level_lin", &input)) {
     32    PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
     33    return NULL;
     34  }
     35
     36  if (input == NULL) {
     37    return NULL;
     38  }
     39
     40  vec = PyAubio_ArrayToCFvec (input);
     41  if (vec == NULL) {
     42    return NULL;
     43  }
     44
     45  level_lin = Py_BuildValue("f", aubio_level_lin(vec));
     46  if (level_lin == NULL) {
     47    PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
     48    return NULL;
     49  }
     50
     51  return level_lin;
     52}
Note: See TracChangeset for help on using the changeset viewer.