Mercurial > hg > qm-dsp
changeset 13:f2b5c4251bf3
...
author | cannam |
---|---|
date | Wed, 23 May 2007 15:22:10 +0000 |
parents | da277e8b5244 |
children | 68801ecbab6a |
files | dsp/onsets/DetectionFunction.cpp dsp/onsets/DetectionFunction.h |
diffstat | 2 files changed, 18 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/dsp/onsets/DetectionFunction.cpp Fri May 18 16:43:17 2007 +0000 +++ b/dsp/onsets/DetectionFunction.cpp Wed May 23 15:22:10 2007 +0000 @@ -35,6 +35,8 @@ m_dataLength = Config.frameLength; m_halfLength = m_dataLength/2; m_DFType = Config.DFType; + m_stepSecs = Config.stepSecs; + m_stepSize = Config.stepSize; m_magHistory = new double[ m_halfLength ]; memset(m_magHistory,0, m_halfLength*sizeof(double)); @@ -98,7 +100,7 @@ retVal = HFC( m_halfLength, m_magnitude); break; - case DF_SPECDIFF: + case DF_SPECDIFF: retVal = specDiff( m_halfLength, m_magnitude); break; @@ -142,10 +144,9 @@ diff= sqrt(temp); - if( src[ i ] > 0.1) - { - val += diff; - } + // (See note in phaseDev below.) + + val += diff; m_magHistory[ i ] = src[ i ]; } @@ -167,12 +168,17 @@ { tmpPhase = (srcPhase[ i ]- 2*m_phaseHistory[ i ]+m_phaseHistoryOld[ i ]); dev = MathUtilities::princarg( tmpPhase ); + + // A previous version of this code only counted the value here + // if the magnitude exceeded 0.1. My impression is that + // doesn't greatly improve the results for "loud" music (so + // long as the peak picker is reasonably sophisticated), but + // does significantly damage its ability to work with quieter + // music, so I'm removing it and counting the result always. + // Same goes for the spectral difference measure above. - if( srcMagnitude[ i ] > 0.1) - { - tmpVal = fabs( dev); - val += tmpVal ; - } + tmpVal = fabs(dev); + val += tmpVal ; m_phaseHistoryOld[ i ] = m_phaseHistory[ i ] ; m_phaseHistory[ i ] = srcPhase[ i ];
--- a/dsp/onsets/DetectionFunction.h Fri May 18 16:43:17 2007 +0000 +++ b/dsp/onsets/DetectionFunction.h Wed May 23 15:22:10 2007 +0000 @@ -55,6 +55,8 @@ int m_DFType; unsigned int m_dataLength; unsigned int m_halfLength; + double m_stepSecs; + unsigned int m_stepSize; double m_dbRise; double* m_magHistory;