comparison 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
comparison
equal deleted inserted replaced
343:24d8ea972643 344:5eb9c2387108
19 class FFTReal; 19 class FFTReal;
20 20
21 class PhaseVocoder 21 class PhaseVocoder
22 { 22 {
23 public: 23 public:
24 //!!! review: size must be a power of two, or not?
24 PhaseVocoder(int size, int hop); 25 PhaseVocoder(int size, int hop);
25 virtual ~PhaseVocoder(); 26 virtual ~PhaseVocoder();
26 27
27 /** 28 /**
28 * Given one frame of time-domain samples, FFT and return the 29 * Given one frame of time-domain samples, FFT and return the
34 * 35 *
35 * mag, phase, and unwrapped must each be non-NULL and point to 36 * mag, phase, and unwrapped must each be non-NULL and point to
36 * enough space for size/2 + 1 values. The redundant conjugate 37 * enough space for size/2 + 1 values. The redundant conjugate
37 * half of the output is not returned. 38 * half of the output is not returned.
38 */ 39 */
39 void process(double *src, double *mag, double *phase, double *unwrapped); 40 void processTimeDomain(const double *src,
41 double *mag, double *phase, double *unwrapped);
42
43 /**
44 * Given one frame of frequency-domain samples, return the
45 * magnitudes, instantaneous phases, and unwrapped phases.
46 *
47 * reals and imags must each contain size/2+1 values (where size
48 * is the frame size value as passed to the PhaseVocoder
49 * constructor).
50 *
51 * mag, phase, and unwrapped must each be non-NULL and point to
52 * enough space for size/2+1 values.
53 */
54 void processFrequencyDomain(const double *reals, const double *imags,
55 double *mag, double *phase, double *unwrapped);
40 56
41 /** 57 /**
42 * Reset the stored phases to zero. Note that this may be 58 * Reset the stored phases to zero. Note that this may be
43 * necessary occasionally (depending on the application) to avoid 59 * necessary occasionally (depending on the application) to avoid
44 * loss of floating-point precision in the accumulated unwrapped 60 * loss of floating-point precision in the accumulated unwrapped
53 void unwrapPhases(double *theta, double *unwrapped); 69 void unwrapPhases(double *theta, double *unwrapped);
54 70
55 int m_n; 71 int m_n;
56 int m_hop; 72 int m_hop;
57 FFTReal *m_fft; 73 FFTReal *m_fft;
74 double *m_time;
58 double *m_imag; 75 double *m_imag;
59 double *m_real; 76 double *m_real;
60 double *m_phase; 77 double *m_phase;
61 double *m_unwrapped; 78 double *m_unwrapped;
62 }; 79 };