diff options
author | matthewsotoudeh <matthewsot@outlook.com> | 2016-09-05 18:10:05 -0700 |
---|---|---|
committer | matthewsotoudeh <matthewsot@outlook.com> | 2016-09-05 18:10:05 -0700 |
commit | 8194d4790500f796c04fe192844dd5c5dc66e900 (patch) | |
tree | 54a3a0571016c9b786cbe1ad08ad7346ec1963e6 | |
parent | ca227e22c764cf7a0b7e7998d1113b4230cc78e3 (diff) |
removed a few unnecessary lines
-rw-r--r-- | MFCCDotNet/MFCCDotNet/MFCC.fs | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/MFCCDotNet/MFCCDotNet/MFCC.fs b/MFCCDotNet/MFCCDotNet/MFCC.fs index 59159a7..782e795 100644 --- a/MFCCDotNet/MFCCDotNet/MFCC.fs +++ b/MFCCDotNet/MFCCDotNet/MFCC.fs @@ -39,21 +39,6 @@ module public MFCC = }; _filterbank - let apply_filter (fft_output, filter : triangle_filter) = - let total = Array.length fft_output - 1; - seq { - for i in 0 .. total do - if (i = filter.peak_bin) then - yield fft_output.[i]; - elif (i > filter.start_bin && i < filter.peak_bin) then - let filter_weight = float (i - filter.start_bin) / float (filter.peak_bin - filter.start_bin); - yield fft_output.[i] * filter_weight; - elif (i > filter.peak_bin && i < filter.end_bin) then - let filter_weight = float (filter.end_bin - i) / float (filter.end_bin - filter.peak_bin); - yield fft_output.[i] * filter_weight; - else yield 0.0; - } - //A more efficient Seq.sum(apply_filter()) let apply_and_sum_filter (fft_output : float[], filter : triangle_filter) = let mutable total = 0.0; @@ -92,13 +77,10 @@ module public MFCC = //let abs_output = complex_output |> Array.map(fun sample -> abs sample.Real + abs sample.Imaginary); let filters = compute_filterbank(num_filters, Array.length abs_output, 48000.0); - let accumulator = Array.zeroCreate<float>(Array.length abs_output); let mel_output = filters |> Seq.take(num_features) |> Seq.map(fun filter -> log10(apply_and_sum_filter(abs_output, filter))) |> Seq.toArray; - //|> Seq.fold (fun acc el -> acc |> Array.mapi(fun index acc_el -> acc_el + (el |> Seq.nth(index)))) accumulator; - let dct_output = dct(mel_output); - dct_output;
\ No newline at end of file + dct(mel_output);
\ No newline at end of file |