annotate dsp/mfcc/MFCC.h @ 251:c3600d3cfe5c

* Add timbral (MFCC) feature option to segmenter
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 10 Jan 2008 16:41:33 +0000
parents a106e551e9a4
children a251fb0de594
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@251 20 bool want_c0;
c@251 21 };
c@251 22
c@251 23 class MFCC
c@251 24 {
c@251 25 public:
c@251 26 MFCC(MFCCConfig config);
c@251 27 virtual ~MFCC();
c@251 28
c@251 29 int process(int length, double *inframe, double *outceps);
c@251 30
c@251 31 int getfftlength() const { return fftSize; }
c@251 32
c@251 33 private:
c@251 34 /* Filter bank parameters */
c@251 35 double lowestFrequency;
c@251 36 int linearFilters;
c@251 37 double linearSpacing;
c@251 38 int logFilters;
c@251 39 double logSpacing;
c@251 40
c@251 41 /* FFT length */
c@251 42 int fftSize;
c@251 43
c@251 44 int totalFilters;
c@251 45
c@251 46 /* Misc. */
c@251 47 int samplingRate;
c@251 48 int nceps;
c@251 49
c@251 50 /* MFCC vector */
c@251 51 double *ceps;
c@251 52
c@251 53 double **mfccDCTMatrix;
c@251 54 double **mfccFilterWeights;
c@251 55
c@251 56 /* The analysis window */
c@251 57 Window<double> *window;
c@251 58
c@251 59 /* For the FFT */
c@251 60 double* imagIn; // always zero
c@251 61 double* realOut;
c@251 62 double* imagOut;
c@251 63
c@251 64 /* Set if user want C0 */
c@251 65 int WANT_C0;
c@251 66 };
c@251 67
c@250 68
c@250 69 #endif
c@250 70