#include <GetKeyMode.h>

Classes

struct  Config
 

Public Member Functions

 GetKeyMode (Config config)
 
virtual ~GetKeyMode ()
 
int process (double *pcmData)
 Process a single time-domain input sample frame of length getBlockSize(). More...
 
double * getKeyStrengths ()
 Return a pointer to an internal 24-element array containing the correlation of the chroma vector generated in the last process() call against the stored key profiles for the 12 major and 12 minor keys, where index 0 is C major and 12 is C minor. More...
 
int getBlockSize ()
 
int getHopSize ()
 

Protected Member Functions

double krumCorr (const double *pDataNorm, const double *pProfileNorm, int shiftProfile, int length)
 

Protected Attributes

double m_hpcpAverage
 
double m_medianAverage
 
int m_decimationFactor
 
Decimatorm_decimator
 
Chromagramm_chroma
 
double * m_chrPointer
 
int m_chromaFrameSize
 
int m_chromaHopSize
 
int m_chromaBufferSize
 
int m_medianWinSize
 
int m_bufferIndex
 
int m_chromaBufferFilling
 
int m_medianBufferFilling
 
double * m_decimatedBuffer
 
double * m_chromaBuffer
 
double * m_meanHPCP
 
double * m_majProfileNorm
 
double * m_minProfileNorm
 
double * m_majCorr
 
double * m_minCorr
 
int * m_medianFilterBuffer
 
int * m_sortedBuffer
 
double * m_keyStrengths
 

Detailed Description

Definition at line 19 of file GetKeyMode.h.

Constructor & Destructor Documentation

Member Function Documentation

int GetKeyMode::process ( double *  pcmData)

Process a single time-domain input sample frame of length getBlockSize().

Successive calls should provide overlapped data with an advance of getHopSize() between frames.

Return a key index in the range 0-24, where 0 indicates no key detected, 1 is C major, and 13 is C minor.

Definition at line 192 of file GetKeyMode.cpp.

References MathUtilities::compareInt(), MathUtilities::getMax(), kBinsPerOctave, krumCorr(), m_bufferIndex, m_chroma, m_chromaBuffer, m_chromaBufferFilling, m_chromaBufferSize, m_chrPointer, m_decimatedBuffer, m_decimator, m_majCorr, m_majProfileNorm, m_meanHPCP, m_medianBufferFilling, m_medianFilterBuffer, m_medianWinSize, m_minCorr, m_minProfileNorm, m_sortedBuffer, MathUtilities::mean(), Decimator::process(), and Chromagram::process().

Referenced by GetKeyMode::Config::Config().

double * GetKeyMode::getKeyStrengths ( )

Return a pointer to an internal 24-element array containing the correlation of the chroma vector generated in the last process() call against the stored key profiles for the 12 major and 12 minor keys, where index 0 is C major and 12 is C minor.

Definition at line 292 of file GetKeyMode.cpp.

References kBinsPerOctave, m_keyStrengths, m_majCorr, and m_minCorr.

Referenced by GetKeyMode::Config::Config().

int GetKeyMode::getBlockSize ( )
inline

Definition at line 64 of file GetKeyMode.h.

References m_chromaFrameSize, and m_decimationFactor.

int GetKeyMode::getHopSize ( )
inline

Definition at line 67 of file GetKeyMode.h.

References krumCorr(), m_chromaHopSize, and m_decimationFactor.

double GetKeyMode::krumCorr ( const double *  pDataNorm,
const double *  pProfileNorm,
int  shiftProfile,
int  length 
)
protected

Definition at line 161 of file GetKeyMode.cpp.

Referenced by getHopSize(), and process().

Member Data Documentation

double GetKeyMode::m_hpcpAverage
protected

Definition at line 75 of file GetKeyMode.h.

Referenced by GetKeyMode().

double GetKeyMode::m_medianAverage
protected

Definition at line 76 of file GetKeyMode.h.

Referenced by GetKeyMode().

int GetKeyMode::m_decimationFactor
protected

Definition at line 77 of file GetKeyMode.h.

Referenced by getBlockSize(), getHopSize(), and GetKeyMode().

Decimator* GetKeyMode::m_decimator
protected

Definition at line 80 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

Chromagram* GetKeyMode::m_chroma
protected

Definition at line 83 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

double* GetKeyMode::m_chrPointer
protected

Definition at line 86 of file GetKeyMode.h.

Referenced by process().

int GetKeyMode::m_chromaFrameSize
protected

Definition at line 89 of file GetKeyMode.h.

Referenced by getBlockSize(), and GetKeyMode().

int GetKeyMode::m_chromaHopSize
protected

Definition at line 92 of file GetKeyMode.h.

Referenced by getHopSize(), and GetKeyMode().

int GetKeyMode::m_chromaBufferSize
protected

Definition at line 94 of file GetKeyMode.h.

Referenced by GetKeyMode(), and process().

int GetKeyMode::m_medianWinSize
protected

Definition at line 95 of file GetKeyMode.h.

Referenced by GetKeyMode(), and process().

int GetKeyMode::m_bufferIndex
protected

Definition at line 97 of file GetKeyMode.h.

Referenced by GetKeyMode(), and process().

int GetKeyMode::m_chromaBufferFilling
protected

Definition at line 98 of file GetKeyMode.h.

Referenced by GetKeyMode(), and process().

int GetKeyMode::m_medianBufferFilling
protected

Definition at line 99 of file GetKeyMode.h.

Referenced by GetKeyMode(), and process().

double* GetKeyMode::m_decimatedBuffer
protected

Definition at line 101 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

double* GetKeyMode::m_chromaBuffer
protected

Definition at line 102 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

double* GetKeyMode::m_meanHPCP
protected

Definition at line 103 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

double* GetKeyMode::m_majProfileNorm
protected

Definition at line 105 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

double* GetKeyMode::m_minProfileNorm
protected

Definition at line 106 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

double* GetKeyMode::m_majCorr
protected

Definition at line 107 of file GetKeyMode.h.

Referenced by GetKeyMode(), getKeyStrengths(), process(), and ~GetKeyMode().

double* GetKeyMode::m_minCorr
protected

Definition at line 108 of file GetKeyMode.h.

Referenced by GetKeyMode(), getKeyStrengths(), process(), and ~GetKeyMode().

int* GetKeyMode::m_medianFilterBuffer
protected

Definition at line 109 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

int* GetKeyMode::m_sortedBuffer
protected

Definition at line 110 of file GetKeyMode.h.

Referenced by GetKeyMode(), process(), and ~GetKeyMode().

double* GetKeyMode::m_keyStrengths
protected

Definition at line 112 of file GetKeyMode.h.

Referenced by GetKeyMode(), getKeyStrengths(), and ~GetKeyMode().


The documentation for this class was generated from the following files: