comparison dsp/keydetection/GetKeyMode.h @ 232:2b74f9646331

* Add key mode detector
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 11 Dec 2006 09:48:33 +0000
parents
children 381758cfbe64
comparison
equal deleted inserted replaced
231:dbc354a00714 232:2b74f9646331
1 /*
2 * Author: c.landone
3 * Description:
4 *
5 * Syntax: C++
6 *
7 * Copyright (c) 2005 Centre for Digital Music ( C4DM )
8 * Queen Mary Univesrity of London
9 *
10 *
11 * This program is not free software; you cannot redistribute it
12 * without the explicit authorization from the centre for digital music,
13 * queen mary university of london
14 *
15 */
16
17 #if !defined GETKEYMODE_H
18 #define GETKEYMODE_H
19
20
21 #include "dsp/rateconversion/Decimator.h"
22 #include "dsp/chromagram/Chromagram.h"
23
24
25 class GetKeyMode
26 {
27 public:
28 GetKeyMode( double hpcpAverage, double medianAverage );
29
30 virtual ~GetKeyMode();
31
32 int process( double* PCMData );
33
34 double krumCorr( double* pData1, double* pData2, unsigned int length );
35
36 unsigned int getBlockSize() { return m_ChromaFrameSize*m_DecimationFactor; }
37 unsigned int getHopSize() { return m_ChromaHopSize*m_DecimationFactor; }
38
39 double* getChroma() { return m_ChrPointer; }
40 unsigned int getChromaSize() { return m_BPO; }
41
42 double* getMeanHPCP() { return m_MeanHPCP; }
43
44 int isModeMinor( int key );
45
46 protected:
47
48 double m_hpcpAverage;
49 double m_medianAverage;
50 unsigned int m_DecimationFactor;
51
52 //Decimator (fixed)
53 Decimator* m_Decimator;
54
55 //chroma configuration
56 ChromaConfig m_CromaConfig;
57
58 //Chromagram object
59 Chromagram* m_Chroma;
60
61 //Chromagram output pointer
62 double* m_ChrPointer;
63
64 //Framesize
65 unsigned int m_ChromaFrameSize;
66 //Hop
67 unsigned int m_ChromaHopSize;
68 //Bins per octave
69 unsigned int m_BPO;
70
71
72 unsigned int m_ChromaBuffersize;
73 unsigned int m_MedianWinsize;
74
75 unsigned int m_bufferindex;
76 unsigned int m_ChromaBufferFilling;
77 unsigned int m_MedianBufferFilling;
78
79
80 double* m_DecimatedBuffer;
81 double* m_ChromaBuffer;
82 double* m_MeanHPCP;
83
84 double* m_MajCorr;
85 double* m_MinCorr;
86 double* m_Keys;
87 int* m_MedianFilterBuffer;
88 int* m_SortedBuffer;
89 };
90
91 #endif // !defined GETKEYMODE_H