Mercurial > hg > silvet
comparison src/Silvet.cpp @ 173:26d054291412
In draft mode, make the CQ transform one octave shorter (bottom octave empty)
author | Chris Cannam |
---|---|
date | Wed, 21 May 2014 12:15:29 +0100 |
parents | 06d19c847a41 |
children | abfd19f5cc1a |
comparison
equal
deleted
inserted
replaced
172:06d19c847a41 | 173:26d054291412 |
---|---|
315 m_resampler = new Resampler(m_inputSampleRate, processingSampleRate); | 315 m_resampler = new Resampler(m_inputSampleRate, processingSampleRate); |
316 } else { | 316 } else { |
317 m_resampler = 0; | 317 m_resampler = 0; |
318 } | 318 } |
319 | 319 |
320 double minFreq = 27.5; | |
321 | |
322 if (!m_hqMode) { | |
323 // We don't actually return any notes from the bottom octave, | |
324 // so we can just pad with zeros | |
325 minFreq *= 2; | |
326 } | |
327 | |
320 CQParameters params(processingSampleRate, | 328 CQParameters params(processingSampleRate, |
321 27.5, | 329 minFreq, |
322 processingSampleRate / 3, | 330 processingSampleRate / 3, |
323 processingBPO); | 331 processingBPO); |
324 | 332 |
325 params.q = 0.95; // MIREX code uses 0.8, but it seems 0.9 or lower | 333 params.q = 0.95; // MIREX code uses 0.8, but it seems 0.9 or lower |
326 // drops the FFT size to 512 from 1024 and alters | 334 // drops the FFT size to 512 from 1024 and alters |
362 if (m_resampler) { | 370 if (m_resampler) { |
363 data = m_resampler->process(data.data(), data.size()); | 371 data = m_resampler->process(data.data(), data.size()); |
364 } | 372 } |
365 | 373 |
366 Grid cqout = m_cq->process(data); | 374 Grid cqout = m_cq->process(data); |
375 | |
376 if (!m_hqMode) { | |
377 // Our CQ is one octave shorter in draft mode, so pad with | |
378 // zeros | |
379 vector<double> octave(m_cq->getBinsPerOctave(), 0.0); | |
380 for (int i = 0; i < int(cqout.size()); ++i) { | |
381 cqout[i].insert(cqout[i].end(), octave.begin(), octave.end()); | |
382 } | |
383 } | |
384 | |
367 FeatureSet fs = transcribe(cqout); | 385 FeatureSet fs = transcribe(cqout); |
368 return fs; | 386 return fs; |
369 } | 387 } |
370 | 388 |
371 Silvet::FeatureSet | 389 Silvet::FeatureSet |