Mercurial > hg > tuning-difference
comparison src/TuningDifference.cpp @ 24:6a75d371938f
Some speed improvements
author | Chris Cannam |
---|---|
date | Fri, 06 Feb 2015 09:01:34 +0000 |
parents | d660db57e902 |
children | 85714824256a |
comparison
equal
deleted
inserted
replaced
23:8c07e9da36c9 | 24:6a75d371938f |
---|---|
302 | 302 |
303 Chromagram::Parameters | 303 Chromagram::Parameters |
304 TuningDifference::paramsForTuningFrequency(double hz) const | 304 TuningDifference::paramsForTuningFrequency(double hz) const |
305 { | 305 { |
306 Chromagram::Parameters params(m_inputSampleRate); | 306 Chromagram::Parameters params(m_inputSampleRate); |
307 params.lowestOctave = 0; | 307 params.lowestOctave = 2; |
308 params.octaveCount = 6; | 308 params.octaveCount = 4; |
309 params.binsPerOctave = m_bpo; | 309 params.binsPerOctave = m_bpo; |
310 params.tuningFrequency = hz; | 310 params.tuningFrequency = hz; |
311 params.atomHopFactor = 0.5; | 311 params.atomHopFactor = 0.5; |
312 params.window = CQParameters::Hann; | |
312 return params; | 313 return params; |
313 } | 314 } |
314 | 315 |
315 TuningDifference::TFeature | 316 TuningDifference::TFeature |
316 TuningDifference::computeFeatureFromSignal(const Signal &signal, double hz) const | 317 TuningDifference::computeFeatureFromSignal(const Signal &signal, double hz) const |
461 | 462 |
462 cerr << "rotation " << rotation << " -> cents " << coarseCents << endl; | 463 cerr << "rotation " << rotation << " -> cents " << coarseCents << endl; |
463 | 464 |
464 double coarseHz = frequencyForCentsAbove440(coarseCents); | 465 double coarseHz = frequencyForCentsAbove440(coarseCents); |
465 | 466 |
466 TFeature coarseFeature = computeFeatureFromSignal(m_other, coarseHz); | 467 TFeature coarseFeature; |
468 if (rotation == 0) { | |
469 coarseFeature = otherFeature; | |
470 } else { | |
471 coarseFeature = computeFeatureFromSignal(m_other, coarseHz); | |
472 } | |
467 double coarseScore = featureDistance(coarseFeature); | 473 double coarseScore = featureDistance(coarseFeature); |
468 | 474 |
469 cerr << "corresponding Hz " << coarseHz << " scores " << coarseScore << endl; | 475 cerr << "corresponding Hz " << coarseHz << " scores " << coarseScore << endl; |
470 | 476 |
471 //!!! This should be returning the fine chroma, not the coarse | 477 //!!! This should be returning the fine chroma, not the coarse |