Mercurial > hg > qm-vamp-plugins
diff plugins/SimilarityPlugin.h @ 47:f8c5f11e60a6
* Add rhythmic similarity to similarity plugin.
Needs testing, and the current weighting parameter (not properly used)
needs revision.
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 18 Jan 2008 18:11:01 +0000 |
parents | 1dc00e4dbae6 |
children | 90fa946fda40 |
line wrap: on
line diff
--- a/plugins/SimilarityPlugin.h Fri Jan 18 14:40:51 2008 +0000 +++ b/plugins/SimilarityPlugin.h Fri Jan 18 18:11:01 2008 +0000 @@ -13,6 +13,9 @@ #include <vamp-sdk/Plugin.h> #include <vamp-sdk/RealTime.h> +#include <vector> +#include <deque> + class MFCC; class Chromagram; class Decimator; @@ -59,16 +62,30 @@ }; void calculateBlockSize() const; + bool needRhythm() const { return m_rhythmWeighting > m_noRhythm; } + bool needTimbre() const { return m_rhythmWeighting < m_allRhythm; } Type m_type; MFCC *m_mfcc; + MFCC *m_rhythmfcc; Chromagram *m_chromagram; Decimator *m_decimator; int m_featureColumnSize; - mutable size_t m_blockSize; - size_t m_fftSize; + float m_rhythmWeighting; + float m_rhythmClipDuration; + float m_rhythmClipOrigin; + int m_rhythmClipFrameSize; + int m_rhythmClipFrames; + int m_rhythmColumnSize; + mutable size_t m_blockSize; // before decimation + size_t m_fftSize; // after decimation int m_channels; + int m_processRate; int m_frameNo; + bool m_done; + + static const float m_noRhythm; + static const float m_allRhythm; std::vector<int> m_lastNonEmptyFrame; // per channel @@ -77,12 +94,23 @@ mutable int m_sortedVectorOutput; mutable int m_meansOutput; mutable int m_variancesOutput; + mutable int m_beatSpectraOutput; typedef std::vector<double> FeatureColumn; typedef std::vector<FeatureColumn> FeatureMatrix; typedef std::vector<FeatureMatrix> FeatureMatrixSet; + typedef std::deque<FeatureColumn> FeatureColumnQueue; + typedef std::vector<FeatureColumnQueue> FeatureQueueSet; + FeatureMatrixSet m_values; + FeatureQueueSet m_rhythmValues; + + FeatureMatrix calculateTimbral(FeatureSet &returnFeatures); + FeatureMatrix calculateRhythmic(FeatureSet &returnFeatures); + double getDistance(const FeatureMatrix &timbral, + const FeatureMatrix &rhythmic, + int i, int j); }; #endif