Mercurial > hg > qm-vamp-plugins
comparison 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 |
comparison
equal
deleted
inserted
replaced
46:26a2e341d358 | 47:f8c5f11e60a6 |
---|---|
10 #ifndef _SIMILARITY_PLUGIN_H_ | 10 #ifndef _SIMILARITY_PLUGIN_H_ |
11 #define _SIMILARITY_PLUGIN_H_ | 11 #define _SIMILARITY_PLUGIN_H_ |
12 | 12 |
13 #include <vamp-sdk/Plugin.h> | 13 #include <vamp-sdk/Plugin.h> |
14 #include <vamp-sdk/RealTime.h> | 14 #include <vamp-sdk/RealTime.h> |
15 | |
16 #include <vector> | |
17 #include <deque> | |
15 | 18 |
16 class MFCC; | 19 class MFCC; |
17 class Chromagram; | 20 class Chromagram; |
18 class Decimator; | 21 class Decimator; |
19 | 22 |
57 TypeMFCC, | 60 TypeMFCC, |
58 TypeChroma | 61 TypeChroma |
59 }; | 62 }; |
60 | 63 |
61 void calculateBlockSize() const; | 64 void calculateBlockSize() const; |
65 bool needRhythm() const { return m_rhythmWeighting > m_noRhythm; } | |
66 bool needTimbre() const { return m_rhythmWeighting < m_allRhythm; } | |
62 | 67 |
63 Type m_type; | 68 Type m_type; |
64 MFCC *m_mfcc; | 69 MFCC *m_mfcc; |
70 MFCC *m_rhythmfcc; | |
65 Chromagram *m_chromagram; | 71 Chromagram *m_chromagram; |
66 Decimator *m_decimator; | 72 Decimator *m_decimator; |
67 int m_featureColumnSize; | 73 int m_featureColumnSize; |
68 mutable size_t m_blockSize; | 74 float m_rhythmWeighting; |
69 size_t m_fftSize; | 75 float m_rhythmClipDuration; |
76 float m_rhythmClipOrigin; | |
77 int m_rhythmClipFrameSize; | |
78 int m_rhythmClipFrames; | |
79 int m_rhythmColumnSize; | |
80 mutable size_t m_blockSize; // before decimation | |
81 size_t m_fftSize; // after decimation | |
70 int m_channels; | 82 int m_channels; |
83 int m_processRate; | |
71 int m_frameNo; | 84 int m_frameNo; |
85 bool m_done; | |
86 | |
87 static const float m_noRhythm; | |
88 static const float m_allRhythm; | |
72 | 89 |
73 std::vector<int> m_lastNonEmptyFrame; // per channel | 90 std::vector<int> m_lastNonEmptyFrame; // per channel |
74 | 91 |
75 mutable int m_distanceMatrixOutput; | 92 mutable int m_distanceMatrixOutput; |
76 mutable int m_distanceVectorOutput; | 93 mutable int m_distanceVectorOutput; |
77 mutable int m_sortedVectorOutput; | 94 mutable int m_sortedVectorOutput; |
78 mutable int m_meansOutput; | 95 mutable int m_meansOutput; |
79 mutable int m_variancesOutput; | 96 mutable int m_variancesOutput; |
97 mutable int m_beatSpectraOutput; | |
80 | 98 |
81 typedef std::vector<double> FeatureColumn; | 99 typedef std::vector<double> FeatureColumn; |
82 typedef std::vector<FeatureColumn> FeatureMatrix; | 100 typedef std::vector<FeatureColumn> FeatureMatrix; |
83 typedef std::vector<FeatureMatrix> FeatureMatrixSet; | 101 typedef std::vector<FeatureMatrix> FeatureMatrixSet; |
84 | 102 |
103 typedef std::deque<FeatureColumn> FeatureColumnQueue; | |
104 typedef std::vector<FeatureColumnQueue> FeatureQueueSet; | |
105 | |
85 FeatureMatrixSet m_values; | 106 FeatureMatrixSet m_values; |
107 FeatureQueueSet m_rhythmValues; | |
108 | |
109 FeatureMatrix calculateTimbral(FeatureSet &returnFeatures); | |
110 FeatureMatrix calculateRhythmic(FeatureSet &returnFeatures); | |
111 double getDistance(const FeatureMatrix &timbral, | |
112 const FeatureMatrix &rhythmic, | |
113 int i, int j); | |
86 }; | 114 }; |
87 | 115 |
88 #endif | 116 #endif |
89 | 117 |