Mercurial > hg > qm-vamp-plugins
comparison plugins/SegmenterPlugin.cpp @ 39:7f499758cb23
* Add MFCC option
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 10 Jan 2008 16:41:43 +0000 |
parents | 9a2edd83775f |
children | 77e394a5f3c9 |
comparison
equal
deleted
inserted
replaced
38:9a2edd83775f | 39:7f499758cb23 |
---|---|
60 | 60 |
61 if (!segmenter) makeSegmenter(); | 61 if (!segmenter) makeSegmenter(); |
62 | 62 |
63 //!!! TODO: print out a helpful error message | 63 //!!! TODO: print out a helpful error message |
64 | 64 |
65 if (stepSize != hopsize) return false; | 65 if (stepSize != hopsize) { |
66 if (blockSize != windowsize) return false; | 66 std::cerr << "SegmenterPlugin::initialise: supplied step size " |
67 << stepSize << " differs from required step size " << hopsize | |
68 << std::endl; | |
69 return false; | |
70 } | |
71 | |
72 if (blockSize != windowsize) { | |
73 std::cerr << "SegmenterPlugin::initialise: supplied block size " | |
74 << blockSize << " differs from required block size " << windowsize | |
75 << std::endl; | |
76 return false; | |
77 } | |
67 | 78 |
68 return true; | 79 return true; |
69 } | 80 } |
70 | 81 |
71 void | 82 void |
105 list.push_back(desc); | 116 list.push_back(desc); |
106 | 117 |
107 ParameterDescriptor desc2; | 118 ParameterDescriptor desc2; |
108 desc2.identifier = "featureType"; | 119 desc2.identifier = "featureType"; |
109 desc2.name = "Feature Type"; | 120 desc2.name = "Feature Type"; |
110 desc2.description = "Try Chroma for acoustic or pre-1980 recordings, otherwise use Constant-Q"; | 121 desc2.description = "Try Chromatic for acoustic or pre-1980 recordings, otherwise use Hybrid"; |
111 desc2.unit = ""; | 122 desc2.unit = ""; |
112 desc2.minValue = 1; | 123 desc2.minValue = 1; |
113 desc2.maxValue = 2; | 124 desc2.maxValue = 3; |
114 desc2.defaultValue = 1; | 125 desc2.defaultValue = 1; |
115 desc2.isQuantized = true; | 126 desc2.isQuantized = true; |
116 desc2.quantizeStep = 1; | 127 desc2.quantizeStep = 1; |
117 desc2.valueNames.push_back("Constant-Q"); | 128 desc2.valueNames.push_back("Hybrid (Constant-Q)"); |
118 desc2.valueNames.push_back("Chroma"); | 129 desc2.valueNames.push_back("Chromatic (Chroma)"); |
130 desc2.valueNames.push_back("Timbral (MFCC)"); | |
119 list.push_back(desc2); | 131 list.push_back(desc2); |
120 | 132 |
121 return list; | 133 return list; |
122 } | 134 } |
123 | 135 |
177 params.hopSize = 0.1; | 189 params.hopSize = 0.1; |
178 params.windowSize = 0.372; | 190 params.windowSize = 0.372; |
179 params.nbins = 12; | 191 params.nbins = 12; |
180 params.histogramLength = 20; | 192 params.histogramLength = 20; |
181 params.neighbourhoodLimit = 40; | 193 params.neighbourhoodLimit = 40; |
194 } | |
195 if (params.featureType == FEATURE_TYPE_MFCC) | |
196 { | |
197 params.ncomponents = 20; | |
198 params.neighbourhoodLimit = 30; | |
182 } | 199 } |
183 delete segmenter; | 200 delete segmenter; |
184 | 201 |
185 segmenter = new ClusterMeltSegmenter(params); | 202 segmenter = new ClusterMeltSegmenter(params); |
186 segmenter->initialise(m_inputSampleRate); | 203 segmenter->initialise(m_inputSampleRate); |