NativeInstruments / ni-media

NI Media is a C++ library for reading and writing audio streams.
MIT License
235 stars 34 forks source link

how to get the waveform data of wav file? #25

Closed ucasiggcas closed 5 years ago

ucasiggcas commented 5 years ago

Dear, Could help me get the waveform data of wav file? THX

marcrambo commented 5 years ago

Hey!

The Wav format is supported on all platforms. What exactly is the problem you are facing? As a starting point you could try the code below which will read in an entire wav file into an interleaved vector.

    auto stream = audio::ifstream("hello.wav");
    auto samples = std::vector<float>(stream.info().num_samples());
    stream >> samples;
ucasiggcas commented 5 years ago

include <boost/range/difference_type.hpp>

include <boost/range/has_range_iterator.hpp>

include <boost/range/value_type.hpp>

Sorry,I can‘t find these three headers,could U help me?

ucasiggcas commented 5 years ago

Could I use it in windows with Visual Studio??

marcrambo commented 5 years ago

It seems like you are missing the boost libraries. Boost is a required dependency. Cmake should have triggered an error during configure time about the missing library. Are you using cmake?

You can use Visual Studio 2015 and above.

ucasiggcas commented 5 years ago

But U haven't proposed the files !!! Couldn't find ! Help ! Thx

FalconPDX commented 5 years ago

Hiya.

You need to install the boost libraries and then include them in your VS solution. Here is a guide for windows: https://www.boost.org/doc/libs/1_68_0/more/getting_started/windows.html

FalconPDX commented 5 years ago

Hi @ucasiggcas did you get it to work? :) I'd like to close this issue if so.