I have to convert a matlab code into Android. This matlab code contains energy calculation as shown below:
first I read the audio file into matrix x, and the sample frequency into fs, and then calculate the energy for each window:
[x, fs] = wavread('C:\1359873105438.wav')
energy=energy+sum(x(1:fs).^2)*Tss;
I am not sure how to convert this into Android/Java.
Have you been through this before? please help me to get over this problem.
thanks in advance for your help
Essentially, you have to do something like this:
How to read the wave files borrowed from this article.
Bottom line is, there isn’t a nice clean way to do it like there is in matlab. There isn’t even a function to directly read in a wave file. Still, it’s relatively straight forward, using the WavFile class the website provides.