annotate dsp/mfcc/MFCC.h @ 96:88f3cfcff55f

A threshold (delta) is added in the peak picking parameters structure (PPickParams). It is used as an offset when computing the smoothed detection function. A constructor for the structure PPickParams is also added to set the parameters to 0 when a structure instance is created. Hence programmes using the peak picking parameter structure and which do not set the delta parameter (e.g. QM Vamp note onset detector) won't be affected by the modifications. Functions modified: - dsp/onsets/PeakPicking.cpp - dsp/onsets/PeakPicking.h - dsp/signalconditioning/DFProcess.cpp - dsp/signalconditioning/DFProcess.h
author mathieub <mathieu.barthet@eecs.qmul.ac.uk>
date Mon, 20 Jun 2011 19:01:48 +0100
parents e5907ae6de17
children 701233f8ed41
rev   line source
cannam@26 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@25 2
cannam@26 3 /*
cannam@26 4 QM DSP Library
cannam@25 5
cannam@26 6 Centre for Digital Music, Queen Mary, University of London.
cannam@26 7 This file copyright 2005 Nicolas Chetry, copyright 2008 QMUL.
Chris@84 8
Chris@84 9 This program is free software; you can redistribute it and/or
Chris@84 10 modify it under the terms of the GNU General Public License as
Chris@84 11 published by the Free Software Foundation; either version 2 of the
Chris@84 12 License, or (at your option) any later version. See the file
Chris@84 13 COPYING included with this distribution for more information.
cannam@26 14 */
cannam@25 15
cannam@26 16 #ifndef MFCC_H
cannam@26 17 #define MFCC_H
cannam@26 18
cannam@26 19 #include "base/Window.h"
cannam@26 20
cannam@64 21 class FFTReal;
cannam@64 22
cannam@26 23 struct MFCCConfig {
cannam@26 24 int FS;
cannam@26 25 int fftsize;
cannam@26 26 int nceps;
cannam@30 27 double logpower;
cannam@26 28 bool want_c0;
cannam@32 29 WindowType window;
cannam@30 30 MFCCConfig(int _FS) :
cannam@32 31 FS(_FS), fftsize(2048), nceps(19),
cannam@32 32 logpower(1.0), want_c0(true), window(HammingWindow) { }
cannam@26 33 };
cannam@26 34
cannam@26 35 class MFCC
cannam@26 36 {
cannam@26 37 public:
cannam@26 38 MFCC(MFCCConfig config);
cannam@26 39 virtual ~MFCC();
cannam@26 40
cannam@30 41 /**
cannam@30 42 * Process time-domain input data. inframe must contain
cannam@30 43 * getfftlength() samples. outceps must contain space for nceps
cannam@30 44 * values, plus one if want_c0 is specified.
cannam@30 45 */
cannam@30 46 int process(const double *inframe, double *outceps);
cannam@30 47
cannam@30 48 /**
cannam@30 49 * Process time-domain input data. real and imag must contain
cannam@30 50 * getfftlength()/2+1 elements (i.e. the conjugate half of the FFT
cannam@30 51 * is not expected). outceps must contain space for nceps values,
cannam@30 52 * plus one if want_c0 is specified.
cannam@30 53 */
cannam@30 54 int process(const double *real, const double *imag, double *outceps);
cannam@26 55
cannam@26 56 int getfftlength() const { return fftSize; }
cannam@26 57
cannam@26 58 private:
cannam@26 59 /* Filter bank parameters */
cannam@26 60 double lowestFrequency;
cannam@26 61 int linearFilters;
cannam@26 62 double linearSpacing;
cannam@26 63 int logFilters;
cannam@26 64 double logSpacing;
cannam@26 65
cannam@26 66 /* FFT length */
cannam@26 67 int fftSize;
cannam@26 68
cannam@26 69 int totalFilters;
cannam@30 70 double logPower;
cannam@26 71
cannam@26 72 /* Misc. */
cannam@26 73 int samplingRate;
cannam@26 74 int nceps;
cannam@26 75
cannam@26 76 /* MFCC vector */
cannam@26 77 double *ceps;
cannam@26 78
cannam@26 79 double **mfccDCTMatrix;
cannam@26 80 double **mfccFilterWeights;
cannam@26 81
cannam@26 82 /* The analysis window */
cannam@26 83 Window<double> *window;
cannam@26 84
cannam@26 85 /* For the FFT */
cannam@30 86 double *realOut;
cannam@30 87 double *imagOut;
cannam@30 88 double *fftMag;
cannam@30 89 double *earMag;
cannam@64 90 FFTReal *fft;
cannam@30 91
cannam@26 92 /* Set if user want C0 */
cannam@26 93 int WANT_C0;
cannam@26 94 };
cannam@26 95
cannam@25 96
cannam@25 97 #endif
cannam@25 98