Centre for Digital Music, Queen Mary, University of London.
This file 2005-2006 Christian Landone.
+ Modifications:
+
+ - delta threshold
+ Description: add delta threshold used as offset in the smoothed
+ detection function
+ Author: Mathieu Barthet
+ Date: June 2010
+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
- COPYING included with this distribution for more information.
+ COPYING included with this distribution for more information.
*/
#include "PeakPicking.h"
Qfilta = Config.QuadThresh.a ;
Qfiltb = Config.QuadThresh.b ;
Qfiltc = Config.QuadThresh.c ;
-
- m_DFProcessingParams.length = m_DFLength;
- m_DFProcessingParams.LPOrd = Config.LPOrd;
- m_DFProcessingParams.LPACoeffs = Config.LPACoeffs;
- m_DFProcessingParams.LPBCoeffs = Config.LPBCoeffs;
+
+ m_DFProcessingParams.length = m_DFLength;
+ m_DFProcessingParams.LPOrd = Config.LPOrd;
+ m_DFProcessingParams.LPACoeffs = Config.LPACoeffs;
+ m_DFProcessingParams.LPBCoeffs = Config.LPBCoeffs;
m_DFProcessingParams.winPre = Config.WinT.pre;
- m_DFProcessingParams.winPost = Config.WinT.post;
+ m_DFProcessingParams.winPost = Config.WinT.post;
m_DFProcessingParams.AlphaNormParam = Config.alpha;
m_DFProcessingParams.isMedianPositive = false;
+ m_DFProcessingParams.delta = Config.delta; //add the delta threshold as an adjustable parameter
m_DFSmoothing = new DFProcess( m_DFProcessingParams );
{
if (len < 4) return;
- vector <double> m_maxima;
+ vector <double> m_maxima;
- // Signal conditioning
+ // Signal conditioning
m_DFSmoothing->process( src, m_workBuffer );
-
+
for( unsigned int u = 0; u < len; u++)
{
- m_maxima.push_back( m_workBuffer[ u ] );
+ m_maxima.push_back( m_workBuffer[ u ] );
}
-
+
quadEval( m_maxima, onsets );
- for(unsigned int b = 0; b < m_maxima.size(); b++)
+ for( int b = 0; b < (int)m_maxima.size(); b++)
{
src[ b ] = m_maxima[ b ];
}
vector <int> m_maxIndex;
vector <int> m_onsetPosition;
-
+
vector <double> m_maxFit;
vector <double> m_poly;
vector <double> m_err;
for (int k = -2; k <= 2; ++k)
{
selMax = src[ m_maxIndex[j] + k ] ;
- m_maxFit.push_back(selMax);
+ m_maxFit.push_back(selMax);
}
TPolyFit::PolyFit2(m_err, m_maxFit, m_poly);
{
idx.push_back(m_maxIndex[j]);
}
-
+
m_maxFit.clear();
}