Hi there,
I'm trying to get the FFT of a pure tone wav file. I've actually added (overloaded) a function in the clunk::WavFile class like follows:
Sample*WavFile::load(clunk::Buffer&buffer,Context&context,conststd::string&fname){FILE*f=fopen(fname.c_str(),"rb");if(!f)throwstd::runtime_error("cannot open file: "+fname);WavFilewav(f);wav.read();std::auto_ptr<Sample>sample(context.create_sample());sample->init(wav._data,wav._spec);sample->name=fname;//Copythedatabuffer=wav._data;returnsample.release();}
Hi there,
I'm trying to get the FFT of a pure tone wav file. I've actually added (overloaded) a function in the clunk::WavFile class like follows:
And in my main I'm doing something like this:
I just want the FFT of the sound file. How can I do it?
I appreciate your help,
Thanks in advance.
Last edit: kazathul 2014-07-18
it's as simple as the following code.
I don't think you need to override something in wave file. I will add the api for getting raw format/sample data from sample right away :)
Sorry for delay in responses, I was on business trip in Taiwan.
Last edit: Vladimir Menshakov 2014-07-18
also you could cast raw sample data via AudioFormat<T> template as follows:
this is the most convenient and fastest way to access raw data.
PS I just added the needed API and removed friend declaration
Last edit: Vladimir Menshakov 2014-07-18
I'm also away for a short vacation at the moment.
I'll definitely look into this once I get back this weekend.
Appreciated.