How do I implement the MATLAB function wavread
in C++?
It means read a WAV file into a vector array.
How do I implement the MATLAB function wavread
in C++?
It means read a WAV file into a vector array.
If you want to do it in C++, there are two options. Use a library, or write your own function that can extract information from WAV files. Several C/C++ libraries such as Juce, SDL etc. have functions/classes that can read WAV files. This is probably total overkill for your case. If you want a simple(ish) library specialised to read audio files, libsndfile sounds (pun not intended) like a good bet. If you must roll your own implementation, a description of the WAV format in C can be found here (Warning: The link leads to a page that allows you to download a zipped MS Word file).