diff dsp/phasevocoder/PhaseVocoder.h @ 344:5eb9c2387108

Phase vocoder: provide time-domain and freq-domain inputs separately; update tests etc
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 03 Oct 2013 12:58:36 +0100
parents c99d83236f0d
children a586888bc06c
line wrap: on
line diff
--- a/dsp/phasevocoder/PhaseVocoder.h	Wed Oct 02 18:22:06 2013 +0100
+++ b/dsp/phasevocoder/PhaseVocoder.h	Thu Oct 03 12:58:36 2013 +0100
@@ -21,6 +21,7 @@
 class PhaseVocoder  
 {
 public:
+    //!!! review: size must be a power of two, or not?
     PhaseVocoder(int size, int hop);
     virtual ~PhaseVocoder();
 
@@ -36,7 +37,22 @@
      * enough space for size/2 + 1 values. The redundant conjugate
      * half of the output is not returned.
      */
-    void process(double *src, double *mag, double *phase, double *unwrapped);
+    void processTimeDomain(const double *src,
+                           double *mag, double *phase, double *unwrapped);
+
+    /**
+     * Given one frame of frequency-domain samples, return the
+     * magnitudes, instantaneous phases, and unwrapped phases.
+     *
+     * reals and imags must each contain size/2+1 values (where size
+     * is the frame size value as passed to the PhaseVocoder
+     * constructor).
+     *
+     * mag, phase, and unwrapped must each be non-NULL and point to
+     * enough space for size/2+1 values.
+     */
+    void processFrequencyDomain(const double *reals, const double *imags,
+                                double *mag, double *phase, double *unwrapped);
 
     /**
      * Reset the stored phases to zero. Note that this may be
@@ -55,6 +71,7 @@
     int m_n;
     int m_hop;
     FFTReal *m_fft;
+    double *m_time;
     double *m_imag;
     double *m_real;
     double *m_phase;