Changeset d6f9b3a
- Timestamp:
- Nov 15, 2009, 3:01:06 PM (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:
- 4bc098c
- Parents:
- 965ea78
- Location:
- interfaces/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/aubio-types.h
r965ea78 rd6f9b3a 36 36 extern PyTypeObject Py_fvecType; 37 37 extern PyObject *PyAubio_FvecToArray (Py_fvec * self); 38 extern PyObject *PyAubio_CFvecToArray (fvec_t * self); 38 39 extern Py_fvec *PyAubio_ArrayToFvec (PyObject * self); 39 40 -
interfaces/python/py-fvec.c
r965ea78 rd6f9b3a 177 177 178 178 PyObject * 179 PyAubio_CFvecToArray (fvec_t * self) 180 { 181 PyObject *array = NULL; 182 uint_t i; 183 npy_intp dims[] = { self->length, 1 }; 184 PyObject *concat = PyList_New (0), *tmp = NULL; 185 for (i = 0; i < self->channels; i++) { 186 tmp = PyArray_SimpleNewFromData (1, dims, AUBIO_NPY_SMPL, self->data[i]); 187 PyList_Append (concat, tmp); 188 Py_DECREF (tmp); 189 } 190 array = PyArray_FromObject (concat, AUBIO_NPY_SMPL, 2, 2); 191 Py_DECREF (concat); 192 return array; 193 } 194 195 PyObject * 179 196 PyAubio_FvecToArray (Py_fvec * self) 180 197 { … … 265 282 static PyMethodDef Py_fvec_methods[] = { 266 283 {"__array__", (PyCFunction) PyAubio_FvecToArray, METH_NOARGS, 267 "Returns the first channelas a numpy array."},284 "Returns the vector as a numpy array."}, 268 285 {NULL} 269 286 };
Note: See TracChangeset
for help on using the changeset viewer.