How to load audio file and. convert it into numpy array


In JUCE project, I want to load audio file and convert it into numpy array.
It’s simple with librosa, a python library, to load and convert an audio file into numpy array. But how can I do this in JUCE with C++?


You could define a C interface to your library and then use SWIG to make Python bindings (I assume your project is a static or dynamic library?)

Please try to avoid shipping yet-another-Python binding in a Windows product, if possible.

Instead, if you have to operate with external Python tools (I’m making the assumption, since … what else is a numpy array good for, in a C++ project?) then use a C++ library - preferably a single-header version - to generate the array and write it to disk: