29 double *freqs, *lower, *center, *upper, *triangleHeight, *fftFreqs;
54 ceps = (
double*)calloc(
nceps+1,
sizeof(
double));
56 ceps = (
double*)calloc(
nceps,
sizeof(
double));
61 for (i = 0; i <
nceps+1; i++) {
70 freqs = (
double*)calloc(totalFilters+2,
sizeof(
double));
72 lower = (
double*)calloc(totalFilters,
sizeof(
double));
73 center = (
double*)calloc(totalFilters,
sizeof(
double));
74 upper = (
double*)calloc(totalFilters,
sizeof(
double));
76 triangleHeight = (
double*)calloc(totalFilters,
sizeof(
double));
77 fftFreqs = (
double*)calloc(
fftSize,
sizeof(
double));
83 for (i = linearFilters; i < totalFilters+2; i++) {
84 freqs[i] = freqs[linearFilters-1] *
89 memcpy(lower, freqs,totalFilters*
sizeof(
double));
90 memcpy(center, &freqs[1],totalFilters*
sizeof(
double));
91 memcpy(upper, &freqs[2],totalFilters*
sizeof(
double));
94 triangleHeight[i] = 2./(upper[i]-lower[i]);
98 fftFreqs[i] = ((double) i / ((
double)
fftSize ) *
107 if ((fftFreqs[j] > lower[i]) && (fftFreqs[j] <= center[i])) {
110 (fftFreqs[j]-lower[i]) / (center[i]-lower[i]);
118 if ((fftFreqs[j]>center[i]) && (fftFreqs[j]<upper[i])) {
121 + triangleHeight[i] * (upper[i]-fftFreqs[j])
122 / (upper[i]-center[i]);
137 const double pi = 3.14159265358979323846264338327950288;
139 for (i = 0; i < nceps+1; i++) {
142 * cos((
double) i * ((double) j + 0.5) / (double) totalFilters * pi);
154 realOut = (
double*)calloc(fftSize,
sizeof(
double));
155 imagOut = (
double*)calloc(fftSize,
sizeof(
double));
157 earMag = (
double*)calloc(totalFilters,
sizeof(
double));
158 fftMag = (
double*)calloc(fftSize/2,
sizeof(
double));
164 free(triangleHeight);
173 for (i = 0; i <
nceps+1; i++) {
207 double *inputData = (
double *)malloc(
fftSize *
sizeof(
double));
208 for (
int i = 0; i <
fftSize; ++i) inputData[i] = inframe[i];
224 for (i = 0; i <
fftSize/2; ++i) {
225 fftMag[i] = sqrt(real[i] * real[i] + imag[i] * imag[i]);
235 for (j = 0; j <
fftSize/2; j++) {
238 if (tmp > 0)
earMag[i] = log10(tmp);
255 for (i = 0; i <
nceps+1; i++) {
263 for (i = 1; i <
nceps+1; i++) {
double ** mfccFilterWeights
int process(const double *inframe, double *outceps)
Process time-domain input data.
void forward(const double *realIn, double *realOut, double *imagOut)
Carry out a forward real-to-complex transform of size nsamples, where nsamples is the value provided ...
Window< double > * window