Signal Processing Library
Program name: cepstra
Language: C
In file: parameter_lib.c
Objective: Calculate the Cepstal Coefficients from the LPC vector
Usage: void cepstral(double lpc[], double cep[], int order);
Parameters:
- lpc - The LPC vector for the window of input data
- cep - The output array to put the calculated data
- order - The order
Return value:
Mathematical Description:
Comments:
User Comments
Code:
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 cepstral function */
|