Changeset 207ed19 for interfaces/python
- Timestamp:
- Oct 2, 2009, 11:24:08 AM (15 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:
- 146280a
- Parents:
- 6b1aafc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/aubiomodule.c
r6b1aafc r207ed19 113 113 } 114 114 115 static char Py_zero_crossing_rate_doc[] = "compute zero crossing rate"; 116 117 static PyObject * 118 Py_zero_crossing_rate (PyObject * self, PyObject * args) 119 { 120 PyObject *input; 121 Py_fvec *vec; 122 PyObject *result; 123 124 if (!PyArg_ParseTuple (args, "O:zero_crossing_rate", &input)) { 125 return NULL; 126 } 127 128 if (input == NULL) { 129 return NULL; 130 } 131 132 vec = PyAubio_ArrayToFvec (input); 133 134 if (vec == NULL) { 135 return NULL; 136 } 137 138 // compute the function 139 result = Py_BuildValue ("f", aubio_zero_crossing_rate (vec->o)); 140 if (result == NULL) { 141 return NULL; 142 } 143 144 return result; 145 } 146 147 static char Py_min_removal_doc[] = "compute zero crossing rate"; 148 149 static PyObject * 150 Py_min_removal(PyObject * self, PyObject * args) 151 { 152 PyObject *input; 153 Py_fvec *vec; 154 155 if (!PyArg_ParseTuple (args, "O:zero_crossing_rate", &input)) { 156 return NULL; 157 } 158 159 if (input == NULL) { 160 return NULL; 161 } 162 163 vec = PyAubio_ArrayToFvec (input); 164 165 if (vec == NULL) { 166 return NULL; 167 } 168 169 // compute the function 170 fvec_min_removal (vec->o); 171 // since this function does not return, we could return None 172 //return Py_None; 173 // however it is convenient to return the modified vector 174 //return (PyObject *) PyAubio_FvecToArray(vec); 175 // or even without converting it back to an array 176 Py_INCREF(vec); 177 return (PyObject *)vec; 178 } 179 180 181 182 115 183 static PyMethodDef aubio_methods[] = { 116 184 {"alpha_norm", Py_alpha_norm, METH_VARARGS, Py_alpha_norm_doc}, 185 {"zero_crossing_rate", Py_zero_crossing_rate, METH_VARARGS, 186 Py_zero_crossing_rate_doc}, 187 {"min_removal", Py_min_removal, METH_VARARGS, Py_min_removal_doc}, 117 188 {NULL, NULL} /* Sentinel */ 118 189 };
Note: See TracChangeset
for help on using the changeset viewer.