annotate dsp/keydetection/GetKeyMode.h @ 298:255e431ae3d4

* Key detector: when returning key strengths, use the peak value of the three underlying chromagram correlations (from 36-bin chromagram) corresponding to each key, instead of the mean. Rationale: This is the same method as used when returning the key value, and it's nice to have the same results in both returned value and plot. The peak performed better than the sum with a simple test set of triads, so it seems reasonable to change the plot to match the key output rather than the other way around. * FFT: kiss_fftr returns only the non-conjugate bins, synthesise the rest rather than leaving them (perhaps dangerously) undefined. Fixes an uninitialised data error in chromagram that could cause garbage results from key detector. * Constant Q: remove precalculated values again, I reckon they're not proving such a good tradeoff.
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 05 Jun 2009 15:12:39 +0000
parents 9aedf5ea8c35
children 715f779d0b4f
rev   line source
c@232 1 /*
c@232 2 * Author: c.landone
c@232 3 * Description:
c@232 4 *
c@232 5 * Syntax: C++
c@232 6 *
c@232 7 * Copyright (c) 2005 Centre for Digital Music ( C4DM )
c@232 8 * Queen Mary Univesrity of London
c@232 9 *
c@232 10 *
c@232 11 * This program is not free software; you cannot redistribute it
c@232 12 * without the explicit authorization from the centre for digital music,
c@232 13 * queen mary university of london
c@232 14 *
c@232 15 */
c@232 16
c@265 17 #ifndef GETKEYMODE_H
c@232 18 #define GETKEYMODE_H
c@232 19
c@232 20
c@232 21 #include "dsp/rateconversion/Decimator.h"
c@232 22 #include "dsp/chromagram/Chromagram.h"
c@232 23
c@232 24
c@232 25 class GetKeyMode
c@232 26 {
c@232 27 public:
c@234 28 GetKeyMode( int sampleRate, float tuningFrequency,
c@234 29 double hpcpAverage, double medianAverage );
c@232 30
c@232 31 virtual ~GetKeyMode();
c@232 32
c@232 33 int process( double* PCMData );
c@232 34
c@232 35 double krumCorr( double* pData1, double* pData2, unsigned int length );
c@232 36
c@232 37 unsigned int getBlockSize() { return m_ChromaFrameSize*m_DecimationFactor; }
c@232 38 unsigned int getHopSize() { return m_ChromaHopSize*m_DecimationFactor; }
c@232 39
c@232 40 double* getChroma() { return m_ChrPointer; }
c@232 41 unsigned int getChromaSize() { return m_BPO; }
c@232 42
c@232 43 double* getMeanHPCP() { return m_MeanHPCP; }
c@232 44
c@265 45 double *getKeyStrengths() { return m_keyStrengths; }
c@265 46
c@268 47 bool isModeMinor( int key );
c@232 48
c@232 49 protected:
c@232 50
c@232 51 double m_hpcpAverage;
c@232 52 double m_medianAverage;
c@232 53 unsigned int m_DecimationFactor;
c@232 54
c@232 55 //Decimator (fixed)
c@232 56 Decimator* m_Decimator;
c@232 57
c@232 58 //chroma configuration
c@234 59 ChromaConfig m_ChromaConfig;
c@232 60
c@232 61 //Chromagram object
c@232 62 Chromagram* m_Chroma;
c@232 63
c@232 64 //Chromagram output pointer
c@232 65 double* m_ChrPointer;
c@232 66
c@232 67 //Framesize
c@232 68 unsigned int m_ChromaFrameSize;
c@232 69 //Hop
c@232 70 unsigned int m_ChromaHopSize;
c@232 71 //Bins per octave
c@232 72 unsigned int m_BPO;
c@232 73
c@232 74
c@232 75 unsigned int m_ChromaBuffersize;
c@232 76 unsigned int m_MedianWinsize;
c@232 77
c@232 78 unsigned int m_bufferindex;
c@232 79 unsigned int m_ChromaBufferFilling;
c@232 80 unsigned int m_MedianBufferFilling;
c@232 81
c@232 82
c@232 83 double* m_DecimatedBuffer;
c@232 84 double* m_ChromaBuffer;
c@232 85 double* m_MeanHPCP;
c@232 86
c@232 87 double* m_MajCorr;
c@232 88 double* m_MinCorr;
c@232 89 double* m_Keys;
c@232 90 int* m_MedianFilterBuffer;
c@232 91 int* m_SortedBuffer;
c@265 92
c@265 93 double *m_keyStrengths;
c@232 94 };
c@232 95
c@232 96 #endif // !defined GETKEYMODE_H