| 1 | #cxx . . $ `<file>/dwtools/MFCC.h`/ifndef _MFCC_h_ |
| 2 | #define _MFCC_h_cxx . . $ `dwtools/MFCC.h:2:9`! |
| 3 | /* MFCC.h |
| 4 | * |
| 5 | * Mel Frequency Cepstral Coefficients class. |
| 6 | * |
| 7 | * Copyright (C) 1993-2017 David Weenink |
| 8 | * |
| 9 | * This code is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or (at |
| 12 | * your option) any later version. |
| 13 | * |
| 14 | * This code is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | djmw 20010501 |
| 25 | djmw 20020813 GPL header |
| 26 | djmw 20120504 Latest modification. |
| 27 | */ |
| 28 | |
| 29 | #include "CC.h"cxx . . $ `<file>/dwtools/CC.h`/ |
| 30 | #include "Sound.h"cxx . . $ `<file>/fon/Sound.h`/ |
| 31 | #include "TableOfReal.h"cxx . . $ `<file>/stat/TableOfReal.h`/ |
| 32 | |
| 33 | Thing_definecxx . . $ MFCC# (MFCC, CC) { |
| 34 | void v1_infocxx . . $ structMFCC#v1_info(49f6e7a06ebc5aa8). () |
| 35 | override; |
| 36 | }; |
| 37 | |
| 38 | /* |
| 39 | Three slightly "different" definitions of MFCC |
| 40 | 1. Davis & Mermelstein |
| 41 | MFCC [i] = SUM (j=1..N, f [j] * cos (i(j-1/2)pi/N)), i = 1..N-1 |
| 42 | 2. Vergin & O'Shaughnessy |
| 43 | MFCC [i] = SUM (j=0..N-1, f [j] * cos (i(j+1/2)pi/N)), i = 0..N-1 |
| 44 | 3. HTK-book |
| 45 | MFCC [i] = sqrt(2/n) SUM (j=1..N, f [j] * cos (i(j-1/2)pi/N)), i = 0..N-1 |
| 46 | |
| 47 | The f [j]'s are the MelSpectrogram values converted to dB. |
| 48 | We follow the definition of Davis and Mermelstein: |
| 49 | MFCC [i] = SUM (j=1..N, f [j] * cos (i(j-1/2)pi/N)), i=1..N-1, |
| 50 | */ |
| 51 | |
| 52 | /* |
| 53 | Interpretation: |
| 54 | Mel frequency cepstral coefficient vectors as a function of time. |
| 55 | c0 represents the sum of the dB filter outputs. |
| 56 | */ |
| 57 | |
| 58 | autoMFCCcxx . . $ autoMFCC# MFCC_createcxx . . $ MFCC_create(7f090c33aa14b585). (double tmin, double tmax, integercxx . . $ integer# nt, double dt, double t1, integercxx . . $ integer# maximumNumberOfCoefficients, double fmin_mel, double fmax_mel); |
| 59 | |
| 60 | void MFCC_liftercxx . . $ MFCC_lifter(34b43019fb85ab3c). (MFCCcxx . . $ MFCC# me, integercxx . . $ integer# lifter); |
| 61 | /* |
| 62 | Lifter the cepstral coefficients: |
| 63 | c [i] *= (1 + lifter / 2 * sin (NUMpi * i / lifter)) |
| 64 | */ |
| 65 | |
| 66 | autoTableOfRealcxx . . $ autoTableOfReal# MFCC_to_TableOfRealcxx . . $ MFCC_to_TableOfReal(7b9f12beb1cbfe33). (MFCCcxx . . $ MFCC# me, bool includeC0); |
| 67 | |
| 68 | autoSoundcxx . . $ autoSound# MFCC_to_Soundcxx . . $ MFCC_to_Sound(6812155c679020aa). (MFCCcxx . . $ MFCC# me); |
| 69 | |
| 70 | autoSoundcxx . . $ autoSound# MFCCs_crossCorrelatecxx . . $ MFCCs_crossCorrelate(635bee82e3ca1db8). (MFCCcxx . . $ MFCC# me, MFCCcxx . . $ MFCC# thee, enum kSounds_convolve_scalingcxx . . $ kSounds_convolve_scaling# scaling, enum kSounds_convolve_signalOutsideTimeDomaincxx . . $ kSounds_convolve_signalOutsideTimeDomain# signalOutsideTimeDomain); |
| 71 | |
| 72 | autoSoundcxx . . $ autoSound# MFCCs_convolvecxx . . $ MFCCs_convolve(635bee82e3ca1db8). (MFCCcxx . . $ MFCC# me, MFCCcxx . . $ MFCC# thee, enum kSounds_convolve_scalingcxx . . $ kSounds_convolve_scaling# scaling, enum kSounds_convolve_signalOutsideTimeDomaincxx . . $ kSounds_convolve_signalOutsideTimeDomain# signalOutsideTimeDomain); |
| 73 | |
| 74 | autoMatrixcxx . . $ autoMatrix# MFCC_to_Matrix_featurescxx . . $ MFCC_to_Matrix_features(a0cadf97fac2eb6a). (MFCCcxx . . $ MFCC# me, double windowLength, bool includeEnergy); |
| 75 | |
| 76 | #endif /* _MFCC_h_ */ |