Mercurial > hg > libxtract
changeset 95:432d97ee02ef
Minor modifications to MFCC init, mainly just code formatting
author | Dan Stowell <danstowell@gmail.com> |
---|---|
date | Wed, 03 Oct 2007 10:01:15 +0000 |
parents | a60dea3e59a9 |
children | 757e6f99dcd7 |
files | src/init.c |
diffstat | 1 files changed, 15 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/init.c Mon Sep 24 10:26:26 2007 +0000 +++ b/src/init.c Wed Oct 03 10:01:15 2007 +0000 @@ -51,7 +51,7 @@ 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 @@ for(n = 0; n < freq_bands; n++){ - /*calculate the rise increment*/ - if(n > 0) + // 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]); - else - inc = height_norm[n] / fft_peak[n]; 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);