Mercurial > hg > qm-dsp
changeset 46:4f1870dbab2c
* Add lots of debug output
author | cannam |
---|---|
date | Thu, 24 Jul 2008 16:09:25 +0000 |
parents | 6458bc785aed |
children | 38bf09927942 |
files | dsp/tempotracking/TempoTrack.cpp |
diffstat | 1 files changed, 41 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/dsp/tempotracking/TempoTrack.cpp Thu Jul 03 14:04:38 2008 +0000 +++ b/dsp/tempotracking/TempoTrack.cpp Thu Jul 24 16:09:25 2008 +0000 @@ -15,6 +15,8 @@ #include <iostream> +#include <cassert> + #define RAY43VAL @@ -162,6 +164,8 @@ numelem = tsig; } + std::cerr << "tempoMM: m_winLength = " << m_winLength << ", m_lagLength = " << m_lagLength << ", numelem = " << numelem << std::endl; + for(i=1;i<m_lagLength-1;i++) { //first and last output values are left intentionally as zero @@ -192,14 +196,14 @@ if (tsig != 0) // i.e. in context dependent state { // NOW FIND MAX INDEX OF ACFOUT - for( i = 0; i < m_lagLength; i++) - { - if( m_tempoScratch[ i ] > maxValRCF) - { - maxValRCF = m_tempoScratch[ i ]; - maxIndexRCF = i; - } - } + for( i = 0; i < m_lagLength; i++) + { + if( m_tempoScratch[ i ] > maxValRCF) + { + maxValRCF = m_tempoScratch[ i ]; + maxIndexRCF = i; + } + } } else // using rayleigh weighting { @@ -300,7 +304,6 @@ // now write the output maxIndexRCF = static_cast<int>(beatPeriod); - } @@ -312,6 +315,8 @@ if( tsig == 0 ) tsig = 4; + +std::cerr << "tempoMM: maxIndexRCF = " << maxIndexRCF << std::endl; if( tsig == 4 ) { @@ -525,6 +530,10 @@ int p = (int)MathUtilities::round( period ); int predictedOffset = 0; + std::cerr << "TempoTrack::createPhaseExtractor: period = " << period << ", p = " << p << std::endl; + + assert(p < 10000); + double* phaseScratch = new double[ p*2 ]; @@ -562,9 +571,12 @@ phaseScratch[ i ] = (temp - PhaseMin)/PhaseMax; } + std::cerr << "predictedOffset = " << predictedOffset << std::endl; + unsigned int index = 0; for(int i = p - ( predictedOffset - 1); i < p + ( p - predictedOffset) + 1; i++) { + std::cerr << "assigning to filter index " << index << " (size = " << p*2 << ")" << std::endl; Filter[ index++ ] = phaseScratch[ i ]; } } @@ -879,6 +891,8 @@ period = periodG[ TTLoopIndex ]; + std::cerr << "TempoTrack::process(2): constFlag == " << constFlag << ", TTLoopIndex = " << TTLoopIndex << ", period from periodG = " << period << std::endl; + createPhaseExtractor( PW, m_winLength, period, FSP, 0 ); constFlag = 0; @@ -889,12 +903,30 @@ if( GW[ 0 ] != 0 ) { period = periodG[ TTLoopIndex ]; + + std::cerr << "TempoTrack::process(2): GW[0] == " << GW[0] << ", TTLoopIndex = " << TTLoopIndex << ", period from periodG = " << period << std::endl; + + if (period > 10000) { + std::cerr << "WARNING! Highly implausible period value!" << std::endl; + std::cerr << "periodG contains (of " << TTFrames << " frames): " << std::endl; + for (int i = 0; i < TTLoopIndex + 3 && i < TTFrames; ++i) { + std::cerr << i << " -> " << periodG[i] << std::endl; + } + std::cerr << "periodP contains (of " << TTFrames << " frames): " << std::endl; + for (int i = 0; i < TTLoopIndex + 3 && i < TTFrames; ++i) { + std::cerr << i << " -> " << periodP[i] << std::endl; + } + } + createPhaseExtractor( PW, m_winLength, period, FSP, lastBeat ); } else { period = periodP[ TTLoopIndex ]; + + std::cerr << "TempoTrack::process(2): GW[0] == " << GW[0] << ", TTLoopIndex = " << TTLoopIndex << ", period from periodP = " << period << std::endl; + createPhaseExtractor( PW, m_winLength, period, FSP, 0 ); } }