I am working on a dynamic link with real-time dynamic link, where I have a 2-dimensional C array with floating point data that represents an audio buffer. One dimension is time (sampling), and the other is a channel. I would like to pass this to a python script as a numpy array for DSP processing, and then I would like to pass this back to C so that the data can carry the processing chain to C. The member function in C ++, which processing looks like this:
void myEffect::process (float** inputs, float** outputs, int buffersize) {
The inputs and outputs of arrays are the same size. Integer buffering is the number of columns in the input and output arrays. On the python side, I would like the processing to be performed by a function that looks like this:
class myPyEffect ... ... def process(self,inBuff):
Now, my question is: how can I most effectively use data in and out of C (avoiding unnecessary copying of memory, etc.)? So far, for simple parameter changes, I have used C-API calls, such as:
pValue = PyObject_CallMethod(pInstance, "setParameter", "(f)", value);
Am I using something similar for my numpy arrays or is there a better way? Thanks for reading.
c ++ c python api numpy
learnvst
source share