Ignore:
Timestamp:
Jul 10, 2015, 2:34:48 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:
0e362b5
Parents:
31a09d2
Message:

ext/py-musicutils.c: add level_detection (closes #21)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/py-musicutils.c

    r31a09d2 r9c8c8a6  
    112112  return silence_detection;
    113113}
     114
     115PyObject *
     116Py_aubio_level_detection(PyObject *self, PyObject *args)
     117{
     118  PyObject *input;
     119  fvec_t *vec;
     120  PyObject *level_detection;
     121  smpl_t threshold;
     122
     123  if (!PyArg_ParseTuple (args, "Of:level_detection", &input, &threshold)) {
     124    PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
     125    return NULL;
     126  }
     127
     128  if (input == NULL) {
     129    return NULL;
     130  }
     131
     132  vec = PyAubio_ArrayToCFvec (input);
     133  if (vec == NULL) {
     134    return NULL;
     135  }
     136
     137  level_detection = Py_BuildValue("f", aubio_level_detection(vec, threshold));
     138  if (level_detection == NULL) {
     139    PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
     140    return NULL;
     141  }
     142
     143  return level_detection;
     144}
Note: See TracChangeset for help on using the changeset viewer.