diff dsp/keydetection/GetKeyMode.h @ 7:85a9e268a8c4

* Add key mode detector
author cannam
date Mon, 11 Dec 2006 09:48:33 +0000
parents
children 381758cfbe64
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dsp/keydetection/GetKeyMode.h	Mon Dec 11 09:48:33 2006 +0000
@@ -0,0 +1,91 @@
+/*
+ * Author: c.landone 
+ * Description:
+ *
+ * Syntax: C++
+ *
+ * Copyright (c) 2005 Centre for Digital Music ( C4DM )
+ *                    Queen Mary Univesrity of London
+ *
+ *
+ * This program is not free software; you cannot redistribute it 
+ * without the explicit authorization from the centre for digital music,
+ * queen mary university of london 
+ *
+ */
+
+#if !defined GETKEYMODE_H
+#define GETKEYMODE_H
+
+
+#include "dsp/rateconversion/Decimator.h"
+#include "dsp/chromagram/Chromagram.h"
+
+
+class GetKeyMode  
+{
+public:
+	GetKeyMode( double hpcpAverage, double medianAverage );
+
+	virtual ~GetKeyMode();
+
+	int process( double* PCMData );
+
+	double krumCorr( double* pData1, double* pData2, unsigned int length );
+
+	unsigned int getBlockSize() { return m_ChromaFrameSize*m_DecimationFactor; }
+	unsigned int getHopSize() { return m_ChromaHopSize*m_DecimationFactor; }
+
+	double* getChroma() { return m_ChrPointer; }
+	unsigned int getChromaSize() { return m_BPO; }
+
+	double* getMeanHPCP() { return m_MeanHPCP; }
+
+	int isModeMinor( int key ); 
+
+protected:
+
+	double m_hpcpAverage;
+	double m_medianAverage;
+	unsigned int m_DecimationFactor;
+
+	//Decimator (fixed)
+	Decimator* m_Decimator;
+
+	//chroma configuration
+	ChromaConfig m_CromaConfig;
+
+	//Chromagram object
+	Chromagram* m_Chroma;
+
+	//Chromagram output pointer
+	double* m_ChrPointer;
+
+	//Framesize
+	unsigned int m_ChromaFrameSize;
+	//Hop
+	unsigned int m_ChromaHopSize;
+	//Bins per octave
+	unsigned int m_BPO;
+
+
+	unsigned int m_ChromaBuffersize;
+	unsigned int m_MedianWinsize;
+	
+	unsigned int m_bufferindex;
+	unsigned int m_ChromaBufferFilling;
+	unsigned int m_MedianBufferFilling;
+	
+
+	double* m_DecimatedBuffer;
+	double* m_ChromaBuffer;
+	double* m_MeanHPCP;
+
+	double* m_MajCorr;
+	double* m_MinCorr;
+	double* m_Keys;
+	int* m_MedianFilterBuffer;
+	int* m_SortedBuffer;
+};
+
+#endif // !defined GETKEYMODE_H