I opened wav file with libsndfile library and want to read through this file and get N number of points in FFT and get time-domain samples and calculate FFT.
any ideas how I could replace fscanf with function from libsndfile library?
here is line of code:
for(i=0; i < N; i++) fscanf(fs, "%lg%lg", &x[i][0], &x[i][1]);
So, problem is I don’t know how to work with wav. without libsndfile and how to implement some things using libsndfile.
thanks,
a.
You say you want to read N samples and then you do:
so you’re reading 2 * N samples and I’m not sure why.
If you grab the libsndfile source code tarball, there are example programs in the examples/ directory. Basically you do:
This code assumes you file is mono (only one channel).