#include <PhaseVocoder.h>

Public Member Functions

 PhaseVocoder (int size, int hop)
 
virtual ~PhaseVocoder ()
 
void processTimeDomain (const double *src, double *mag, double *phase, double *unwrapped)
 Given one frame of time-domain samples, FFT and return the magnitudes, instantaneous phases, and unwrapped phases. More...
 
void processFrequencyDomain (const double *reals, const double *imags, double *mag, double *phase, double *unwrapped)
 Given one frame of frequency-domain samples, return the magnitudes, instantaneous phases, and unwrapped phases. More...
 
void reset ()
 Reset the stored phases to zero. More...
 

Protected Member Functions

void FFTShift (double *src)
 
void getMagnitudes (double *mag)
 
void getPhases (double *theta)
 
void unwrapPhases (double *theta, double *unwrapped)
 

Protected Attributes

int m_n
 
int m_hop
 
FFTRealm_fft
 
double * m_time
 
double * m_imag
 
double * m_real
 
double * m_phase
 
double * m_unwrapped
 

Detailed Description

Definition at line 21 of file PhaseVocoder.h.

Constructor & Destructor Documentation

PhaseVocoder::PhaseVocoder ( int  size,
int  hop 
)

Definition at line 27 of file PhaseVocoder.cpp.

References m_fft, m_imag, m_n, m_phase, m_real, m_time, m_unwrapped, and reset().

PhaseVocoder::~PhaseVocoder ( )
virtual

Definition at line 46 of file PhaseVocoder.cpp.

References m_fft, m_imag, m_phase, m_real, m_time, and m_unwrapped.

Member Function Documentation

void PhaseVocoder::processTimeDomain ( const double *  src,
double *  mag,
double *  phase,
double *  unwrapped 
)

Given one frame of time-domain samples, FFT and return the magnitudes, instantaneous phases, and unwrapped phases.

src must have size values (where size is the frame size value as passed to the PhaseVocoder constructor), and should have been windowed as necessary by the caller (but not fft-shifted).

mag, phase, and unwrapped must each be non-NULL and point to enough space for size/2 + 1 values. The redundant conjugate half of the output is not returned.

Definition at line 66 of file PhaseVocoder.cpp.

References FFTShift(), FFTReal::forward(), getMagnitudes(), getPhases(), m_fft, m_imag, m_n, m_real, m_time, and unwrapPhases().

Referenced by DetectionFunction::processTimeDomain().

void PhaseVocoder::processFrequencyDomain ( const double *  reals,
const double *  imags,
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.

Definition at line 80 of file PhaseVocoder.cpp.

References getMagnitudes(), getPhases(), m_imag, m_n, m_real, and unwrapPhases().

Referenced by DetectionFunction::processFrequencyDomain().

void PhaseVocoder::reset ( )

Reset the stored phases to zero.

Note that this may be necessary occasionally (depending on the application) to avoid loss of floating-point precision in the accumulated unwrapped phase values as they grow.

Definition at line 94 of file PhaseVocoder.cpp.

References m_hop, m_n, m_phase, and m_unwrapped.

Referenced by PhaseVocoder().

void PhaseVocoder::FFTShift ( double *  src)
protected

Definition at line 56 of file PhaseVocoder.cpp.

References m_n.

Referenced by processTimeDomain().

void PhaseVocoder::getMagnitudes ( double *  mag)
protected

Definition at line 107 of file PhaseVocoder.cpp.

References m_imag, m_n, and m_real.

Referenced by processFrequencyDomain(), and processTimeDomain().

void PhaseVocoder::getPhases ( double *  theta)
protected

Definition at line 114 of file PhaseVocoder.cpp.

References m_imag, m_n, and m_real.

Referenced by processFrequencyDomain(), and processTimeDomain().

void PhaseVocoder::unwrapPhases ( double *  theta,
double *  unwrapped 
)
protected

Definition at line 121 of file PhaseVocoder.cpp.

References m_hop, m_n, m_phase, m_unwrapped, and MathUtilities::princarg().

Referenced by processFrequencyDomain(), and processTimeDomain().

Member Data Documentation

int PhaseVocoder::m_n
protected
int PhaseVocoder::m_hop
protected

Definition at line 71 of file PhaseVocoder.h.

Referenced by reset(), and unwrapPhases().

FFTReal* PhaseVocoder::m_fft
protected

Definition at line 72 of file PhaseVocoder.h.

Referenced by PhaseVocoder(), processTimeDomain(), and ~PhaseVocoder().

double* PhaseVocoder::m_time
protected

Definition at line 73 of file PhaseVocoder.h.

Referenced by PhaseVocoder(), processTimeDomain(), and ~PhaseVocoder().

double* PhaseVocoder::m_imag
protected
double* PhaseVocoder::m_real
protected
double* PhaseVocoder::m_phase
protected

Definition at line 76 of file PhaseVocoder.h.

Referenced by PhaseVocoder(), reset(), unwrapPhases(), and ~PhaseVocoder().

double* PhaseVocoder::m_unwrapped
protected

Definition at line 77 of file PhaseVocoder.h.

Referenced by PhaseVocoder(), reset(), unwrapPhases(), and ~PhaseVocoder().


The documentation for this class was generated from the following files: