GetKeyMode.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 /*
3  Copyright (c) 2005 Centre for Digital Music ( C4DM )
4  Queen Mary Univesrity of London
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of the
9  License, or (at your option) any later version. See the file
10  COPYING included with this distribution for more information.
11  */
12 
13 #ifndef QM_DSP_GETKEYMODE_H
14 #define QM_DSP_GETKEYMODE_H
15 
16 class Decimator;
17 class Chromagram;
18 
19 class GetKeyMode
20 {
21 public:
22  struct Config {
23  double sampleRate;
25  double hpcpAverage;
26  double medianAverage;
27  int frameOverlapFactor; // 1 = none (default, fast, but means
28  // we skip a fair bit of input data);
29  // 8 = normal chroma overlap
31 
32  Config(double _sampleRate, float _tuningFrequency) :
33  sampleRate(_sampleRate),
34  tuningFrequency(_tuningFrequency),
35  hpcpAverage(10),
36  medianAverage(10),
37  frameOverlapFactor(1),
38  decimationFactor(8) {
39  }
40  };
41 
42  GetKeyMode(Config config);
43 
44  virtual ~GetKeyMode();
45 
54  int process(double *pcmData);
55 
62  double *getKeyStrengths();
63 
64  int getBlockSize() {
66  }
67  int getHopSize() {
69  }
70 
71 protected:
72  double krumCorr(const double *pDataNorm, const double *pProfileNorm,
73  int shiftProfile, int length);
74 
75  double m_hpcpAverage;
78 
79  // Decimator (fixed)
81 
82  // Chromagram object
84 
85  // Chromagram output pointer
86  double* m_chrPointer;
87 
88  // Framesize
90 
91  // Hop
93 
96 
100 
102  double* m_chromaBuffer;
103  double* m_meanHPCP;
104 
107  double* m_majCorr;
108  double* m_minCorr;
111 
112  double *m_keyStrengths;
113 };
114 
115 #endif // !defined QM_DSP_GETKEYMODE_H
double * m_meanHPCP
Definition: GetKeyMode.h:103
double * m_majCorr
Definition: GetKeyMode.h:107
int * m_medianFilterBuffer
Definition: GetKeyMode.h:109
double * m_majProfileNorm
Definition: GetKeyMode.h:105
double * m_keyStrengths
Definition: GetKeyMode.h:112
Chromagram * m_chroma
Definition: GetKeyMode.h:83
int m_decimationFactor
Definition: GetKeyMode.h:77
int m_medianWinSize
Definition: GetKeyMode.h:95
double * m_decimatedBuffer
Definition: GetKeyMode.h:101
double * m_chromaBuffer
Definition: GetKeyMode.h:102
int m_chromaHopSize
Definition: GetKeyMode.h:92
int process(double *pcmData)
Process a single time-domain input sample frame of length getBlockSize().
Definition: GetKeyMode.cpp:192
virtual ~GetKeyMode()
Definition: GetKeyMode.cpp:144
double m_hpcpAverage
Definition: GetKeyMode.h:75
double medianAverage
Definition: GetKeyMode.h:26
Config(double _sampleRate, float _tuningFrequency)
Definition: GetKeyMode.h:32
GetKeyMode(Config config)
Definition: GetKeyMode.cpp:54
double krumCorr(const double *pDataNorm, const double *pProfileNorm, int shiftProfile, int length)
Definition: GetKeyMode.cpp:161
int * m_sortedBuffer
Definition: GetKeyMode.h:110
int m_bufferIndex
Definition: GetKeyMode.h:97
double * getKeyStrengths()
Return a pointer to an internal 24-element array containing the correlation of the chroma vector gene...
Definition: GetKeyMode.cpp:292
double * m_chrPointer
Definition: GetKeyMode.h:86
int m_chromaBufferFilling
Definition: GetKeyMode.h:98
double * m_minCorr
Definition: GetKeyMode.h:108
Decimator * m_decimator
Definition: GetKeyMode.h:80
int getBlockSize()
Definition: GetKeyMode.h:64
double m_medianAverage
Definition: GetKeyMode.h:76
Decimator carries out a fast downsample by a power-of-two factor.
Definition: Decimator.h:24
double * m_minProfileNorm
Definition: GetKeyMode.h:106
int m_medianBufferFilling
Definition: GetKeyMode.h:99
int getHopSize()
Definition: GetKeyMode.h:67
int m_chromaFrameSize
Definition: GetKeyMode.h:89
int m_chromaBufferSize
Definition: GetKeyMode.h:94