Mercurial > hg > tony
comparison src/Analyser.cpp @ 223:d323b5d41570
Use CHP plugin for local frequency-constrained analysis
author | Chris Cannam |
---|---|
date | Fri, 07 Mar 2014 16:01:04 +0000 |
parents | 43cc5f7cc554 |
children | 9bdff8d10a86 |
comparison
equal
deleted
inserted
replaced
222:43cc5f7cc554 | 223:d323b5d41570 |
---|---|
266 myLayer->copy(m_pane, sel, m_preAnalysis); | 266 myLayer->copy(m_pane, sel, m_preAnalysis); |
267 } | 267 } |
268 | 268 |
269 TransformFactory *tf = TransformFactory::getInstance(); | 269 TransformFactory *tf = TransformFactory::getInstance(); |
270 | 270 |
271 QString plugname = "pYIN"; | 271 QString plugname1 = "pYIN"; |
272 QString plugname2 = "CHP"; | |
273 | |
272 QString base = "vamp:pyin:localcandidatepyin:"; | 274 QString base = "vamp:pyin:localcandidatepyin:"; |
273 QString out = "pitchtrackcandidates"; | 275 QString out = "pitchtrackcandidates"; |
274 | 276 |
275 if (range.isConstrained()) { | 277 if (range.isConstrained()) { |
276 base = "vamp:pyin:yinfc:"; | 278 base = "vamp:chp:constrainedharmonicpeak:"; |
277 out = "f0"; | 279 out = "peak"; |
278 } | 280 } |
279 | 281 |
280 Transforms transforms; | 282 Transforms transforms; |
281 | 283 |
282 QString notFound = tr("Transform \"%1\" not found. Unable to perform interactive analysis.<br><br>Is the %2 Vamp plugin correctly installed?"); | 284 QString notFound = tr("Transform \"%1\" not found. Unable to perform interactive analysis.<br><br>Are the %2 and %3 Vamp plugins correctly installed?"); |
283 if (!tf->haveTransform(base + out)) { | 285 if (!tf->haveTransform(base + out)) { |
284 return notFound.arg(base + out).arg(plugname); | 286 return notFound.arg(base + out).arg(plugname1).arg(plugname2); |
285 } | 287 } |
286 | 288 |
287 Transform t = tf->getDefaultTransformFor | 289 Transform t = tf->getDefaultTransformFor |
288 (base + out, m_fileModel->getSampleRate()); | 290 (base + out, m_fileModel->getSampleRate()); |
289 t.setStepSize(256); | 291 t.setStepSize(256); |
290 t.setBlockSize(2048); | 292 t.setBlockSize(2048); |
291 | 293 |
292 if (range.isConstrained()) { | 294 if (range.isConstrained()) { |
293 t.setParameter("minfreq", range.min); | 295 t.setParameter("minfreq", range.min); |
294 t.setParameter("maxfreq", range.max); | 296 t.setParameter("maxfreq", range.max); |
297 t.setBlockSize(4096); | |
295 } | 298 } |
296 | 299 |
297 RealTime start = RealTime::frame2RealTime | 300 RealTime start = RealTime::frame2RealTime |
298 (round(sel.getStartFrame()*1.0/256) * 256 - 4*256, m_fileModel->getSampleRate()); // 4*256 is for 4 frames offset due to timestamp shift | 301 (round(sel.getStartFrame()*1.0/256) * 256 - 4*256, m_fileModel->getSampleRate()); // 4*256 is for 4 frames offset due to timestamp shift |
299 | 302 |