Voice Lab
cepstral
void cepstral(double lpc[], double cep[], int order)
{
int n, k;
double sumation, ratio;
if(order >= MAX_ALLOC_SIZE) {
fprintf(stderr, "Please increase MAX_ALLOC_SIZE in window_lib.h to at least %d\n", order+1);
exit(1);
}
/* Information taken from Douglas O'Shaughnessy's book */
/* "Speech Communication, Human and Machine" 1990, page 356 equation 8.39 */
/* lpc[0] = 1.0, coming from lpc routine */
/* computed values stored from lpc[1] thru lpc[order] */
/* copy the 1.0 at lpc[0] */
cep[0] = lpc[0];
/* equation 8.39 page 356 */
for(n = 1; n <= order; n++) {
sumation = 0.0;
for(k = 1; k < n; k++) {
ratio = (double)(k)/(double)(n);
sumation += ratio*cep[k]*lpc[n-k];
}
cep[n] = lpc[n] + sumation;
}
} /* End of the Cepstra function */
No comments:
Post a Comment