phase
Functions
-
int main(int argc, char *argv[])
phase [ option ] [ infile ]
-l int
FFT length
-m int
order of numerator coefficients
-n int
order of denominator coefficients
-z str
name of file containing numerator coefficients
-p str
name of file containing denominator coefficients
-u bool
perform phase unwrapping
infile str
double-type real sequence
stdout
double-type phase
The below example calculates phase spectrum from 10-th order filter coefficients:
phase -z data.z -m 10 -p data.p -n 10 -l 16 > data.ph
If the filter coefficients are stable, the below example gives the same result:
impulse -l 16 | dfs -z data.z -p data.p | phase -l 16 > data.ph
- Parameters
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns
0 on success, 1 on failure.
-
class sptk::FilterCoefficientsToPhaseSpectrum
Transform filter coefficients to phase spectrum.
The input is the
-th order numerator coefficients and the -th order denominator coefficients: -length phase spectrum: is the FFT length.The general form of transfer function is given by
. It can be rewritten as and denote the real and imaginary parts. ThusPublic Functions
-
FilterCoefficientsToPhaseSpectrum(int num_numerator_order, int num_denominator_order, int fft_length, bool unwrapping)
- Parameters
num_numerator_order – [in] Order of numerator coefficients,
.num_denominator_order – [in] Order of denominator coefficients,
.fft_length – [in] Number of FFT bins,
.unwrapping – [in] If true, perform phase unwrapping.
-
inline int GetNumNumeratorOrder() const
- Returns
Order of numerator coefficients.
-
inline int GetNumDenominatorOrder() const
- Returns
Order of denominator coefficients.
-
inline int GetFftLength() const
- Returns
FFT length.
-
inline bool IsUnwrapped() const
- Returns
True if unwrapping is performed.
-
inline bool IsValid() const
- Returns
True if this object is valid.
-
bool Run(const std::vector<double> &numerator_coefficients, const std::vector<double> &denominator_coefficients, std::vector<double> *phase_spectrum, FilterCoefficientsToPhaseSpectrum::Buffer *buffer) const
- Parameters
numerator_coefficients – [in]
-th order coefficients.denominator_coefficients – [in]
-th order coefficients.phase_spectrum – [out]
-length phase spectrum.buffer – [out] Buffer.
- Returns
True on success, false on failure.
-
class Buffer
Buffer for FilterCoefficientsToPhaseSpectrum class.
-
FilterCoefficientsToPhaseSpectrum(int num_numerator_order, int num_denominator_order, int fft_length, bool unwrapping)