annotate dsp/mfcc/MFCC.h @ 272:330c2e11f8a9

* Build fixes for gcc 4.3.2 * _Maybe_, but probably not, fix crash in tempo tracker... let's see how we get on
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 10 Nov 2008 14:01:55 +0000
parents 9619d6995b73
children 6cb2b3cd5356
rev   line source
c@251 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@250 2
c@251 3 /*
c@251 4 QM DSP Library
c@250 5
c@251 6 Centre for Digital Music, Queen Mary, University of London.
c@251 7 This file copyright 2005 Nicolas Chetry, copyright 2008 QMUL.
c@251 8 All rights reserved.
c@251 9 */
c@250 10
c@251 11 #ifndef MFCC_H
c@251 12 #define MFCC_H
c@251 13
c@251 14 #include "base/Window.h"
c@251 15
c@251 16 struct MFCCConfig {
c@251 17 int FS;
c@251 18 int fftsize;
c@251 19 int nceps;
c@255 20 double logpower;
c@251 21 bool want_c0;
c@257 22 WindowType window;
c@255 23 MFCCConfig(int _FS) :
c@257 24 FS(_FS), fftsize(2048), nceps(19),
c@257 25 logpower(1.0), want_c0(true), window(HammingWindow) { }
c@251 26 };
c@251 27
c@251 28 class MFCC
c@251 29 {
c@251 30 public:
c@251 31 MFCC(MFCCConfig config);
c@251 32 virtual ~MFCC();
c@251 33
c@255 34 /**
c@255 35 * Process time-domain input data. inframe must contain
c@255 36 * getfftlength() samples. outceps must contain space for nceps
c@255 37 * values, plus one if want_c0 is specified.
c@255 38 */
c@255 39 int process(const double *inframe, double *outceps);
c@255 40
c@255 41 /**
c@255 42 * Process time-domain input data. real and imag must contain
c@255 43 * getfftlength()/2+1 elements (i.e. the conjugate half of the FFT
c@255 44 * is not expected). outceps must contain space for nceps values,
c@255 45 * plus one if want_c0 is specified.
c@255 46 */
c@255 47 int process(const double *real, const double *imag, double *outceps);
c@251 48
c@251 49 int getfftlength() const { return fftSize; }
c@251 50
c@251 51 private:
c@251 52 /* Filter bank parameters */
c@251 53 double lowestFrequency;
c@251 54 int linearFilters;
c@251 55 double linearSpacing;
c@251 56 int logFilters;
c@251 57 double logSpacing;
c@251 58
c@251 59 /* FFT length */
c@251 60 int fftSize;
c@251 61
c@251 62 int totalFilters;
c@255 63 double logPower;
c@251 64
c@251 65 /* Misc. */
c@251 66 int samplingRate;
c@251 67 int nceps;
c@251 68
c@251 69 /* MFCC vector */
c@251 70 double *ceps;
c@251 71
c@251 72 double **mfccDCTMatrix;
c@251 73 double **mfccFilterWeights;
c@251 74
c@251 75 /* The analysis window */
c@251 76 Window<double> *window;
c@251 77
c@251 78 /* For the FFT */
c@255 79 double *imagIn; // always zero
c@255 80 double *realOut;
c@255 81 double *imagOut;
c@255 82 double *fftMag;
c@255 83 double *earMag;
c@255 84
c@251 85 /* Set if user want C0 */
c@251 86 int WANT_C0;
c@251 87 };
c@251 88
c@250 89
c@250 90 #endif
c@250 91