aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/init.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/init.c b/src/init.c
index 09e2d77..35802d0 100644
--- a/src/init.c
+++ b/src/init.c
@@ -51,7 +51,7 @@ int xtract_init_mfcc(int N, float nyquist, int style, float freq_min, float freq
M = N >> 1;
mel_peak[0] = mel_freq_min;
- lin_peak[0] = 700 * (exp(mel_peak[0] / 1127) - 1);
+ lin_peak[0] = freq_min; // === 700 * (exp(mel_peak[0] / 1127) - 1);
fft_peak[0] = lin_peak[0] / nyquist * M;
@@ -79,38 +79,38 @@ int xtract_init_mfcc(int N, float nyquist, int style, float freq_min, float freq
for(n = 0; n < freq_bands; n++){
- /*calculate the rise increment*/
- if(n > 0)
- inc = height_norm[n] / (fft_peak[n] - fft_peak[n - 1]);
- else
+ // calculate the rise increment
+ if(n==0)
inc = height_norm[n] / fft_peak[n];
+ else
+ inc = height_norm[n] / (fft_peak[n] - fft_peak[n - 1]);
val = 0;
- /*zero the start of the array*/
- for(k = 0; k < i; k++)
- fft_tables[n][k] = 0.f;
+ // zero the start of the array
+ for(k = 0; k < i; k++)
+ fft_tables[n][k] = 0.f;
- /*fill in the rise */
+ // fill in the rise
for(; i <= fft_peak[n]; i++){
fft_tables[n][i] = val;
val += inc;
}
- /*calculate the fall increment */
+ // calculate the fall increment
inc = height_norm[n] / (fft_peak[n + 1] - fft_peak[n]);
val = 0;
- next_peak = fft_peak[n + 1];
+ next_peak = fft_peak[n + 1];
- /*reverse fill the 'fall' */
+ // reverse fill the 'fall'
for(i = next_peak; i > fft_peak[n]; i--){
fft_tables[n][i] = val;
val += inc;
}
- /*zero the rest of the array*/
- for(k = next_peak + 1; k < N; k++)
- fft_tables[n][k] = 0.f;
+ // zero the rest of the array
+ for(k = next_peak + 1; k < N; k++)
+ fft_tables[n][k] = 0.f;
}
free(mel_peak);