Mercurial > hg > qm-dsp
comparison dsp/tempotracking/TempoTrack.cpp @ 487:5998ee1042d3
Use M_PI
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 31 May 2019 16:33:55 +0100 |
parents | 7e52c034cf62 |
children | 103156707542 |
comparison
equal
deleted
inserted
replaced
486:7132d952b9a6 | 487:5998ee1042d3 |
---|---|
118 } else { | 118 } else { |
119 m_sigma = beatLag/4; | 119 m_sigma = beatLag/4; |
120 for( i = 0; i < winLength; i++ ) { | 120 for( i = 0; i < winLength; i++ ) { |
121 double dlag = (double)(i+1) - beatLag; | 121 double dlag = (double)(i+1) - beatLag; |
122 Filter[ i ] = exp(-0.5 * pow(( dlag / m_sigma), 2.0) ) / | 122 Filter[ i ] = exp(-0.5 * pow(( dlag / m_sigma), 2.0) ) / |
123 (sqrt( 2 * PI) * m_sigma); | 123 (sqrt(TWO_PI) * m_sigma); |
124 } | 124 } |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 double TempoTrack::tempoMM(double* ACF, double* weight, int tsig) | 128 double TempoTrack::tempoMM(double* ACF, double* weight, int tsig) |
517 double PhaseMax = 0.0; | 517 double PhaseMax = 0.0; |
518 int scratchLength = p*2; | 518 int scratchLength = p*2; |
519 double temp = 0.0; | 519 double temp = 0.0; |
520 | 520 |
521 for( int i = 0; i < scratchLength; i++ ) { | 521 for( int i = 0; i < scratchLength; i++ ) { |
522 phaseScratch[ i ] = exp( -0.5 * pow( ( i - mu ) / sigma, 2 ) ) / ( sqrt( 2*PI ) *sigma ); | 522 phaseScratch[ i ] = exp( -0.5 * pow( ( i - mu ) / sigma, 2 ) ) / ( sqrt(TWO_PI) *sigma ); |
523 } | 523 } |
524 | 524 |
525 MathUtilities::getFrameMinMax( phaseScratch, scratchLength, &PhaseMin, &PhaseMax ); | 525 MathUtilities::getFrameMinMax( phaseScratch, scratchLength, &PhaseMin, &PhaseMax ); |
526 | 526 |
527 for(int i = 0; i < scratchLength; i ++) { | 527 for(int i = 0; i < scratchLength; i ++) { |