You need to use some kind of FFT in order to benefit from the fantastic speed increase possible with the Convolution Theorem. Right. A*B= fourier AxB, or cepstral A+B. I know a bit about Fourier theory, real and imaginary and radix-2 etc optimisations although I have never implemented one myself (no need). Some form of radix optimization is exactly what I suggested to Nicolas (Chetry) with whom I wrote the amdf-based voicing_detector~ , but he's writing his PhD now and has no time for this. What I am wondering is how to turn any form of autocorrelation matrix into a radix-type algorithm, so that code such as the two examples enclosed can be optimized.
...maybe I should take another degree? if only!
Ed
-> -> --> ---> -----> --------> -------------> (insert quote here) --------------------------------- To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.
for (i=1;i<l;i++) /* the Average Magnitude Difference Function */ { for (j=start;j<=end;j++) { temp[j] = i + j < l ? in[i+j] : 0.0; temp0 = atom_getfloatarg(i, 4096, ctl->otemp); temp0 += i == 0 ? 0.0 : fabs(in[j] - temp[j]); } temp0 += ((float)i / (float)l) * ctl->f_sum_abs; SETFLOAT(&ctl->otemp[i], temp0); }
/* compute autocorrelations */ for (i=0;i<=order;i++) { sum = 0; for (k=0;k<(n-i);k++) sum += x[k] * x[k+i]; r[i] = sum; }
/* compute predictor coefficients */ if (r[0] == 0) /* no signal ! */ retcode = 1; else { *pe = r[0]; pc[0] = 1.0; for (k=1;k<=order;k++) { sum = 0; for (i=1;i<=k;i++) sum -= pc[k-i] * r[i]; akk = sum/(*pe); /* new predictor coefficients */ pc[k] = akk; for (i=1;i<=(k/2);i++) { ai = pc[i]; aj = pc[k-i]; pc[i] = ai + akk * aj; pc[k-i] = aj + akk * ai; } /* new prediction error */ *pe = *pe * (1.0 - akk*akk); if (*pe <= 0) /* negative/zero error ! */ retcode = 2; } }