Changeset 31a09d2 for python/ext
- Timestamp:
- Jul 10, 2015, 2:26:27 AM (9 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:
- 9c8c8a6
- Parents:
- 665b711
- Location:
- python/ext
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/aubiomodule.c
r665b711 r31a09d2 243 243 {"level_lin", Py_aubio_level_lin, METH_VARARGS, Py_aubio_level_lin_doc}, 244 244 {"db_spl", Py_aubio_db_spl, METH_VARARGS, Py_aubio_db_spl_doc}, 245 {"silence_detection", Py_aubio_silence_detection, METH_VARARGS, Py_aubio_silence_detection_doc}, 245 246 {"window", Py_aubio_window, METH_VARARGS, Py_aubio_window_doc}, 246 247 {NULL, NULL} /* Sentinel */ -
python/ext/py-musicutils.c
r665b711 r31a09d2 81 81 return db_spl; 82 82 } 83 84 PyObject * 85 Py_aubio_silence_detection(PyObject *self, PyObject *args) 86 { 87 PyObject *input; 88 fvec_t *vec; 89 PyObject *silence_detection; 90 smpl_t threshold; 91 92 if (!PyArg_ParseTuple (args, "Of:silence_detection", &input, &threshold)) { 93 PyErr_SetString (PyExc_ValueError, "failed parsing arguments"); 94 return NULL; 95 } 96 97 if (input == NULL) { 98 return NULL; 99 } 100 101 vec = PyAubio_ArrayToCFvec (input); 102 if (vec == NULL) { 103 return NULL; 104 } 105 106 silence_detection = Py_BuildValue("I", aubio_silence_detection(vec, threshold)); 107 if (silence_detection == NULL) { 108 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection"); 109 return NULL; 110 } 111 112 return silence_detection; 113 } -
python/ext/py-musicutils.h
r665b711 r31a09d2 46 46 PyObject * Py_aubio_db_spl(PyObject *self, PyObject *args); 47 47 48 static char Py_aubio_silence_detection_doc[] = "" 49 "Check if buffer level in dB SPL is under a given threshold\n" 50 "\n" 51 "Return 0 if level is under the given threshold, 1 otherwise.\n" 52 "\n" 53 "Example\n" 54 "-------\n" 55 "\n" 56 ">>> import numpy\n""" 57 ">>> silence_detection(numpy.ones(1024, dtype=\"float32\"), -80)\n" 58 "0"; 59 60 PyObject * Py_aubio_silence_detection(PyObject *self, PyObject *args); 61 48 62 #endif /* _PY_AUBIO_MUSICUTILS_H_ */
Note: See TracChangeset
for help on using the changeset viewer.