Mercurial > hg > tuning-difference
comparison chroma-compare-plugin/TuningDifference.h @ 13:c74071731d74
The bulk of the chroma-compare implementation. Should be using the newly refactored Chromagram class from libcq though (chroma is currently upside-down!)
author | Chris Cannam |
---|---|
date | Wed, 04 Feb 2015 15:10:07 +0000 |
parents | 23572f9d25d9 |
children | 994f5294996d |
comparison
equal
deleted
inserted
replaced
12:23572f9d25d9 | 13:c74071731d74 |
---|---|
1 #ifndef TUNING_DIFFERENCE_H | 1 #ifndef TUNING_DIFFERENCE_H |
2 #define TUNING_DIFFERENCE_H | 2 #define TUNING_DIFFERENCE_H |
3 | 3 |
4 #include <vamp-sdk/Plugin.h> | 4 #include <vamp-sdk/Plugin.h> |
5 | |
6 #include <cq/CQSpectrogram.h> | |
7 | |
8 #include <memory> | |
5 | 9 |
6 using std::string; | 10 using std::string; |
7 using std::vector; | 11 using std::vector; |
8 | 12 |
9 class TuningDifference : public Vamp::Plugin | 13 class TuningDifference : public Vamp::Plugin |
42 Vamp::RealTime timestamp); | 46 Vamp::RealTime timestamp); |
43 | 47 |
44 FeatureSet getRemainingFeatures(); | 48 FeatureSet getRemainingFeatures(); |
45 | 49 |
46 protected: | 50 protected: |
51 typedef vector<float> Signal; | |
52 typedef vector<double> Chroma; | |
53 typedef vector<double> TFeature; | |
54 | |
55 int m_bpo; | |
56 std::unique_ptr<CQSpectrogram> m_refCQ; | |
57 Chroma m_refTotals; | |
58 TFeature m_refFeature; | |
59 Signal m_other; | |
47 int m_blockSize; | 60 int m_blockSize; |
48 vector<double> m_sum[2]; | |
49 int m_frameCount; | 61 int m_frameCount; |
62 | |
63 CQParameters paramsForTuningFrequency(double hz) const; | |
64 TFeature computeFeatureFromTotals(const Chroma &totals) const; | |
65 TFeature computeFeatureFromSignal(const Signal &signal, double hz) const; | |
66 double featureDistance(const TFeature &other, int rotation = 0) const; | |
67 int findBestRotation(const TFeature &other) const; | |
68 | |
69 mutable std::map<string, int> m_outputs; | |
50 }; | 70 }; |
51 | 71 |
52 | 72 |
53 #endif | 73 #endif |