diff dsp/onsets/DetectionFunction.cpp @ 115:f3c69325cca2 pvoc

Do actual phase unwrapping in the phase vocoder!
author Chris Cannam
date Wed, 02 Oct 2013 15:05:34 +0100
parents f976d7609700
children 2020c73dc997
line wrap: on
line diff
--- a/dsp/onsets/DetectionFunction.cpp	Wed Oct 02 15:04:38 2013 +0100
+++ b/dsp/onsets/DetectionFunction.cpp	Wed Oct 02 15:05:34 2013 +0100
@@ -40,7 +40,7 @@
 void DetectionFunction::initialise( DFConfig Config )
 {
     m_dataLength = Config.frameLength;
-    m_halfLength = m_dataLength/2;
+    m_halfLength = m_dataLength/2 + 1;
 
     m_DFType = Config.DFType;
     m_stepSize = Config.stepSize;
@@ -65,11 +65,12 @@
 
     // See note in process(const double *) below
     int actualLength = MathUtilities::previousPowerOfTwo(m_dataLength);
-    m_phaseVoc = new PhaseVocoder(actualLength);
+    m_phaseVoc = new PhaseVocoder(actualLength, m_stepSize);
 
     m_DFWindowedFrame = new double[ m_dataLength ];
     m_magnitude = new double[ m_halfLength ];
     m_thetaAngle = new double[ m_halfLength ];
+    m_unwrapped = new double[ m_halfLength ];
 
     m_window = new Window<double>(HanningWindow, m_dataLength);
 }
@@ -111,7 +112,8 @@
         }
     }
 
-    m_phaseVoc->process(m_DFWindowedFrame, m_magnitude, m_thetaAngle);
+    m_phaseVoc->process(m_DFWindowedFrame, m_magnitude,
+                        m_thetaAngle, m_unwrapped);
 
     if (m_whiten) whiten();