Mercurial > hg > silvet
comparison src/Silvet.cpp @ 51:782ca0d9ff3e
More outputs
author | Chris Cannam |
---|---|
date | Mon, 07 Apr 2014 17:07:36 +0100 |
parents | 9b17bbd16a5f |
children | 22553e7b2a63 |
comparison
equal
deleted
inserted
replaced
49:9b17bbd16a5f | 51:782ca0d9ff3e |
---|---|
163 Silvet::getOutputDescriptors() const | 163 Silvet::getOutputDescriptors() const |
164 { | 164 { |
165 OutputList list; | 165 OutputList list; |
166 | 166 |
167 OutputDescriptor d; | 167 OutputDescriptor d; |
168 d.identifier = "transcription"; | 168 d.identifier = "notes"; |
169 d.name = "Transcription"; | 169 d.name = "Note transcription"; |
170 d.description = ""; //!!! | 170 d.description = "Overall note transcription across all instruments"; |
171 d.unit = "Hz"; | 171 d.unit = "Hz"; |
172 d.hasFixedBinCount = true; | 172 d.hasFixedBinCount = true; |
173 d.binCount = 2; | 173 d.binCount = 2; |
174 d.binNames.push_back("Frequency"); | 174 d.binNames.push_back("Frequency"); |
175 d.binNames.push_back("Velocity"); | 175 d.binNames.push_back("Velocity"); |
176 d.hasKnownExtents = false; | 176 d.hasKnownExtents = false; |
177 d.isQuantized = false; | 177 d.isQuantized = false; |
178 d.sampleType = OutputDescriptor::VariableSampleRate; | 178 d.sampleType = OutputDescriptor::VariableSampleRate; |
179 d.sampleRate = m_inputSampleRate / (m_cq ? m_cq->getColumnHop() : 256); | 179 d.sampleRate = m_inputSampleRate / (m_cq ? m_cq->getColumnHop() : 62); |
180 d.hasDuration = true; | 180 d.hasDuration = true; |
181 m_notesOutputNo = list.size(); | 181 m_notesOutputNo = list.size(); |
182 list.push_back(d); | 182 list.push_back(d); |
183 | 183 |
184 d.identifier = "cq"; | |
185 d.name = "Raw constant-Q"; | |
186 d.description = "Unfiltered constant-Q time-frequency distribution"; | |
187 d.unit = ""; | |
188 d.hasFixedBinCount = true; | |
189 d.binCount = processingHeight + 55; | |
190 d.binNames.clear(); | |
191 if (m_cq) { | |
192 char name[20]; | |
193 for (int i = 0; i < processingHeight + 55; ++i) { | |
194 float freq = m_cq->getBinFrequency(i); | |
195 sprintf(name, "%.1f Hz", freq); | |
196 d.binNames.push_back(name); | |
197 } | |
198 } | |
199 d.hasKnownExtents = false; | |
200 d.isQuantized = false; | |
201 d.sampleType = OutputDescriptor::FixedSampleRate; | |
202 d.sampleRate = m_inputSampleRate / (m_cq ? m_cq->getColumnHop() : 62); | |
203 d.hasDuration = false; | |
204 m_cqOutputNo = list.size(); | |
205 list.push_back(d); | |
206 | |
184 d.identifier = "inputgrid"; | 207 d.identifier = "inputgrid"; |
185 d.name = "Filtered time-frequency grid"; | 208 d.name = "Filtered constant-Q"; |
186 d.description = "The pre-processed constant-Q time-frequency distribution used as input to the PLCA step"; | 209 d.description = "Filtered constant-Q time-frequency distribution used as input to the PLCA step"; |
187 d.unit = ""; | 210 d.unit = ""; |
188 d.hasFixedBinCount = true; | 211 d.hasFixedBinCount = true; |
189 d.binCount = processingHeight; | 212 d.binCount = processingHeight; |
190 d.binNames.clear(); | 213 d.binNames.clear(); |
191 if (m_cq) { | 214 if (m_cq) { |
199 d.hasKnownExtents = false; | 222 d.hasKnownExtents = false; |
200 d.isQuantized = false; | 223 d.isQuantized = false; |
201 d.sampleType = OutputDescriptor::FixedSampleRate; | 224 d.sampleType = OutputDescriptor::FixedSampleRate; |
202 d.sampleRate = 25; | 225 d.sampleRate = 25; |
203 d.hasDuration = false; | 226 d.hasDuration = false; |
204 m_cqOutputNo = list.size(); | 227 m_fcqOutputNo = list.size(); |
205 list.push_back(d); | 228 list.push_back(d); |
206 | 229 |
207 d.identifier = "pitchdistribution"; | 230 d.identifier = "pitches"; |
208 d.name = "Pitch distribution"; | 231 d.name = "Pitch activation"; |
209 d.description = "The estimated pitch contribution matrix"; | 232 d.description = "Estimated pitch activation matrix"; |
210 d.unit = ""; | 233 d.unit = ""; |
211 d.hasFixedBinCount = true; | 234 d.hasFixedBinCount = true; |
212 d.binCount = processingNotes; | 235 d.binCount = processingNotes; |
213 d.binNames.clear(); | 236 d.binNames.clear(); |
214 for (int i = 0; i < processingNotes; ++i) { | 237 for (int i = 0; i < processingNotes; ++i) { |
311 if (m_resampler) { | 334 if (m_resampler) { |
312 data = m_resampler->process(data.data(), data.size()); | 335 data = m_resampler->process(data.data(), data.size()); |
313 } | 336 } |
314 | 337 |
315 Grid cqout = m_cq->process(data); | 338 Grid cqout = m_cq->process(data); |
316 return transcribe(cqout); | 339 FeatureSet fs = transcribe(cqout); |
340 | |
341 for (int i = 0; i < (int)cqout.size(); ++i) { | |
342 Feature f; | |
343 for (int j = 0; j < (int)cqout[i].size(); ++j) { | |
344 f.values.push_back(float(cqout[i][j])); | |
345 } | |
346 fs[m_cqOutputNo].push_back(f); | |
347 } | |
348 | |
349 return fs; | |
317 } | 350 } |
318 | 351 |
319 Silvet::FeatureSet | 352 Silvet::FeatureSet |
320 Silvet::getRemainingFeatures() | 353 Silvet::getRemainingFeatures() |
321 { | 354 { |
322 Grid cqout = m_cq->getRemainingBlocks(); | 355 Grid cqout = m_cq->getRemainingBlocks(); |
323 return transcribe(cqout); | 356 FeatureSet fs = transcribe(cqout); |
357 | |
358 for (int i = 0; i < (int)cqout.size(); ++i) { | |
359 Feature f; | |
360 for (int j = 0; j < (int)cqout[i].size(); ++j) { | |
361 f.values.push_back(float(cqout[i][j])); | |
362 } | |
363 fs[m_cqOutputNo].push_back(f); | |
364 } | |
365 | |
366 return fs; | |
324 } | 367 } |
325 | 368 |
326 Silvet::FeatureSet | 369 Silvet::FeatureSet |
327 Silvet::transcribe(const Grid &cqout) | 370 Silvet::transcribe(const Grid &cqout) |
328 { | 371 { |
333 for (int i = 0; i < (int)filtered.size(); ++i) { | 376 for (int i = 0; i < (int)filtered.size(); ++i) { |
334 Feature f; | 377 Feature f; |
335 for (int j = 0; j < processingHeight; ++j) { | 378 for (int j = 0; j < processingHeight; ++j) { |
336 f.values.push_back(float(filtered[i][j])); | 379 f.values.push_back(float(filtered[i][j])); |
337 } | 380 } |
338 fs[m_cqOutputNo].push_back(f); | 381 fs[m_fcqOutputNo].push_back(f); |
339 } | 382 } |
340 | 383 |
341 int width = filtered.size(); | 384 int width = filtered.size(); |
342 | 385 |
343 int iterations = 12; | 386 int iterations = 12; |