I found this autocorrelation code, but I simply don't know what is "float_vec_t", for example. Is it a class or something? (I am trying to translate it to Action-script or JavaScript, which I know well)
class LPCAnalysis{
public:
float_vec_t LPCAnalysis::autoCorrelation(const float_vec_t &x);
};
/* Calculate the (UN-normalized) autocorrelation for a frame of a
signal */
float_vec_t LPCAnalysis::autoCorrelation(const float_vec_t &x)
{
short order=x.size();
float_vec_t R(order);
float sum;
int i,j;
for (i=0;i<order;i++) {
sum=0;
for (j=0;j<order-i;j++) {
sum+=x[j]*x[j+i];
}
R[i]=sum;
}
return R;
}
below is my progress so far:
function LPCAnalysis (x:Array) {
var order:int = x.length
var R:Array= []
var sum:Number
var i:int
var j:int
for (i=0;i<order;i++) {
sum = 0
for (j=0;j<order-i;j++) {
sum+=x[j]*x[j+i]
}
R[i] = sum
}
return R
}
Also, how can I extract the final frequency from the array R? (if R is an array). And what are the parameters that I should give to the function? An FFT result, a microphone signal?
Aucun commentaire:
Enregistrer un commentaire