Mercurial > hg > qm-vamp-plugins
comparison plugins/ConstantQSpectrogram.cpp @ 52:4fe04e706839
* Add some descriptions etc
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Wed, 30 Jan 2008 13:33:23 +0000 |
parents | 64e4c8aec287 |
children | b084e87b83e4 |
comparison
equal
deleted
inserted
replaced
51:64e4c8aec287 | 52:4fe04e706839 |
---|---|
96 | 96 |
97 ParameterDescriptor desc; | 97 ParameterDescriptor desc; |
98 desc.identifier = "minpitch"; | 98 desc.identifier = "minpitch"; |
99 desc.name = "Minimum Pitch"; | 99 desc.name = "Minimum Pitch"; |
100 desc.unit = "MIDI units"; | 100 desc.unit = "MIDI units"; |
101 desc.description = "MIDI pitch corresponding to the lowest frequency to be included in the constant-Q transform"; | |
101 desc.minValue = 0; | 102 desc.minValue = 0; |
102 desc.maxValue = 127; | 103 desc.maxValue = 127; |
103 desc.defaultValue = 36; | 104 desc.defaultValue = 36; |
104 desc.isQuantized = true; | 105 desc.isQuantized = true; |
105 desc.quantizeStep = 1; | 106 desc.quantizeStep = 1; |
106 list.push_back(desc); | 107 list.push_back(desc); |
107 | 108 |
108 desc.identifier = "maxpitch"; | 109 desc.identifier = "maxpitch"; |
109 desc.name = "Maximum Pitch"; | 110 desc.name = "Maximum Pitch"; |
110 desc.unit = "MIDI units"; | 111 desc.unit = "MIDI units"; |
112 desc.description = "MIDI pitch corresponding to the highest frequency to be included in the constant-Q transform"; | |
111 desc.minValue = 0; | 113 desc.minValue = 0; |
112 desc.maxValue = 127; | 114 desc.maxValue = 127; |
113 desc.defaultValue = 84; | 115 desc.defaultValue = 84; |
114 desc.isQuantized = true; | 116 desc.isQuantized = true; |
115 desc.quantizeStep = 1; | 117 desc.quantizeStep = 1; |
116 list.push_back(desc); | 118 list.push_back(desc); |
117 | 119 |
118 desc.identifier = "tuning"; | 120 desc.identifier = "tuning"; |
119 desc.name = "Tuning Frequency"; | 121 desc.name = "Tuning Frequency"; |
120 desc.unit = "Hz"; | 122 desc.unit = "Hz"; |
123 desc.description = "Frequency of concert A"; | |
121 desc.minValue = 420; | 124 desc.minValue = 420; |
122 desc.maxValue = 460; | 125 desc.maxValue = 460; |
123 desc.defaultValue = 440; | 126 desc.defaultValue = 440; |
124 desc.isQuantized = false; | 127 desc.isQuantized = false; |
125 list.push_back(desc); | 128 list.push_back(desc); |
126 | 129 |
127 desc.identifier = "bpo"; | 130 desc.identifier = "bpo"; |
128 desc.name = "Bins per Octave"; | 131 desc.name = "Bins per Octave"; |
129 desc.unit = "bins"; | 132 desc.unit = "bins"; |
133 desc.description = "Number of constant-Q transform bins per octave"; | |
130 desc.minValue = 2; | 134 desc.minValue = 2; |
131 desc.maxValue = 36; | 135 desc.maxValue = 36; |
132 desc.defaultValue = 12; | 136 desc.defaultValue = 12; |
133 desc.isQuantized = true; | 137 desc.isQuantized = true; |
134 desc.quantizeStep = 1; | 138 desc.quantizeStep = 1; |
135 list.push_back(desc); | 139 list.push_back(desc); |
136 | 140 |
137 desc.identifier = "normalized"; | 141 desc.identifier = "normalized"; |
138 desc.name = "Normalized"; | 142 desc.name = "Normalized"; |
139 desc.unit = ""; | 143 desc.unit = ""; |
144 desc.description = "Whether to normalize each output column to unit maximum"; | |
140 desc.minValue = 0; | 145 desc.minValue = 0; |
141 desc.maxValue = 1; | 146 desc.maxValue = 1; |
142 desc.defaultValue = 0; | 147 desc.defaultValue = 0; |
143 desc.isQuantized = true; | 148 desc.isQuantized = true; |
144 desc.quantizeStep = 1; | 149 desc.quantizeStep = 1; |
201 } | 206 } |
202 | 207 |
203 if (channels < getMinChannelCount() || | 208 if (channels < getMinChannelCount() || |
204 channels > getMaxChannelCount()) return false; | 209 channels > getMaxChannelCount()) return false; |
205 | 210 |
206 std::cerr << "ConstantQSpectrogram::initialise: step " << stepSize << ", block " | |
207 << blockSize << std::endl; | |
208 | |
209 setupConfig(); | 211 setupConfig(); |
210 | 212 |
211 m_cq = new ConstantQ(m_config); | 213 m_cq = new ConstantQ(m_config); |
212 m_bins = m_cq->getK(); | 214 m_bins = m_cq->getK(); |
213 m_cq->sparsekernel(); | 215 m_cq->sparsekernel(); |
214 m_step = m_cq->gethop(); | 216 m_step = m_cq->gethop(); |
215 m_block = m_cq->getfftlength(); | 217 m_block = m_cq->getfftlength(); |
216 | 218 |
217 //!!! stepSize != m_step should not be an error | 219 if (blockSize != m_block) { |
218 | 220 std::cerr << "ConstantQSpectrogram::initialise: ERROR: supplied block size " << blockSize << " differs from required block size " << m_block << ", initialise failing" << std::endl; |
219 if (stepSize != m_step || | |
220 blockSize != m_block) { | |
221 delete m_cq; | 221 delete m_cq; |
222 m_cq = 0; | 222 m_cq = 0; |
223 return false; | 223 return false; |
224 } | |
225 | |
226 if (stepSize != m_step) { | |
227 std::cerr << "ConstantQSpectrogram::initialise: NOTE: supplied step size " << stepSize << " differs from expected step size " << m_step << " (for block size = " << m_block << ")" << std::endl; | |
224 } | 228 } |
225 | 229 |
226 return true; | 230 return true; |
227 } | 231 } |
228 | 232 |
266 | 270 |
267 OutputDescriptor d; | 271 OutputDescriptor d; |
268 d.identifier = "constantq"; | 272 d.identifier = "constantq"; |
269 d.name = "Constant-Q Spectrogram"; | 273 d.name = "Constant-Q Spectrogram"; |
270 d.unit = ""; | 274 d.unit = ""; |
275 d.description = "Output of constant-Q transform, as a single vector per process block"; | |
271 d.hasFixedBinCount = true; | 276 d.hasFixedBinCount = true; |
272 d.binCount = m_bins; | 277 d.binCount = m_bins; |
273 | 278 |
274 // std::cerr << "Bin count " << d.binCount << std::endl; | 279 // std::cerr << "Bin count " << d.binCount << std::endl; |
275 | 280 |