# HG changeset patch # User Chris Cannam # Date 1381834320 -3600 # Node ID 2053a308bb4d38b23e68387923f52c75acf3bb6f # Parent 6ec45e85ed819bf8a16393602cdf21ca8bd5f9f2 Frame length no longer needs to be a power of two diff -r 6ec45e85ed81 -r 2053a308bb4d dsp/onsets/DetectionFunction.cpp --- a/dsp/onsets/DetectionFunction.cpp Tue Oct 15 11:38:18 2013 +0100 +++ b/dsp/onsets/DetectionFunction.cpp Tue Oct 15 11:52:00 2013 +0100 @@ -63,9 +63,7 @@ m_magPeaks = new double[ m_halfLength ]; memset(m_magPeaks,0, m_halfLength*sizeof(double)); - // See note in processTimeDomain below - int actualLength = MathUtilities::previousPowerOfTwo(m_dataLength); - m_phaseVoc = new PhaseVocoder(actualLength, m_stepSize); + m_phaseVoc = new PhaseVocoder(m_dataLength, m_stepSize); m_magnitude = new double[ m_halfLength ]; m_thetaAngle = new double[ m_halfLength ]; @@ -96,23 +94,6 @@ { m_window->cut(samples, m_windowed); - // Our own FFT implementation supports power-of-two sizes only. - // If we have to use this implementation (as opposed to the - // version of process() below that operates on frequency domain - // data directly), we will have to use the next smallest power of - // two from the block size. Results may vary accordingly! - - int actualLength = MathUtilities::previousPowerOfTwo((int)m_dataLength); - - if (actualLength != (int)m_dataLength) { - // Pre-fill mag and phase vectors with zero, as the FFT output - // will not fill the arrays - for (int i = actualLength/2; i < (int)m_dataLength/2; ++i) { - m_magnitude[i] = 0; - m_thetaAngle[0] = 0; - } - } - m_phaseVoc->processTimeDomain(m_windowed, m_magnitude, m_thetaAngle, m_unwrapped); diff -r 6ec45e85ed81 -r 2053a308bb4d dsp/onsets/DetectionFunction.h --- a/dsp/onsets/DetectionFunction.h Tue Oct 15 11:38:18 2013 +0100 +++ b/dsp/onsets/DetectionFunction.h Tue Oct 15 11:52:00 2013 +0100 @@ -29,7 +29,7 @@ struct DFConfig{ unsigned int stepSize; // DF step in samples - unsigned int frameLength; // DF analysis window - usually 2*step + unsigned int frameLength; // DF analysis window - usually 2*step. Must be even! int DFType; // type of detection function ( see defines ) double dbRise; // only used for broadband df (and required for it) bool adaptiveWhitening; // perform adaptive whitening