freqt

Functions

int main(int argc, char *argv[])

freqt [ option ] [ infile ]

  • -m int

    • order of minimum phase sequence \((0 \le M_1)\)

  • -M int

    • order of warped sequence \((0 \le M_2)\)

  • -a double

    • all-pass constant of input sequence \((|\alpha_1|<1)\)

  • -A double

    • all-pass constant of output sequence \((|\alpha_2|<1)\)

  • infile str

    • double-type minimum phase sequence

  • stdout

    • double-type warped sequence

The below example converts LPC coefficients into LPC mel-cepstral coefficients:

lpc2c < data.lpc | freqt -A 0.42 > data.lpcmc

The converted LPC mel-cepstral coefficients can be reverted if \(M_2\) is sufficiently greater than \(M_1\):

freqt -A -0.42 < data.lpcmc > data.lpc

Parameters
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns

0 on success, 1 on failure.

See also

mgc2mgc

class sptk::FrequencyTransform

Transform a minimum phase sequence into a frequency-warped sequence.

The input is the \(M_1\)-th order minimum phase sequence:

\[ \begin{array}{cccc} c_{\alpha_1}(0), & c_{\alpha_1}(1), & \ldots, & c_{\alpha_1}(M_1), \end{array} \]
and the output is the \(M_2\)-th order frequency-warped sequence:
\[ \begin{array}{cccc} c_{\alpha_2}(0), & c_{\alpha_2}(1), & \ldots, & c_{\alpha_2}(M_2). \end{array} \]
The output sequence can be obtained by using the following recursion formula:
\[\begin{split} c_{\alpha_2}^{(i)}(m) = \left\{\begin{array}{ll} c_{\alpha_1}(-i) + \alpha\,c_{\alpha_2}^{(i-1)}(0), & m=0 \\ (1-\alpha^2)\,c_{\alpha_2}^{(i-1)}(0) + \alpha\,c_{\alpha_2}^{(i-1)}(1), & m=1 \\ c_{\alpha_2}^{(i-1)}(m-1) + \alpha (c_{\alpha_2}^{(i-1)}(m) - c_{\alpha_2}^{(i)}(m-1)), & m=2,3,\ldots,M_2 \end{array} \right. \\ i = -M_1,\ldots,-1,0 \end{split}\]
where
\[ \alpha = (\alpha_2 - \alpha_1)\,/\,(1 - \alpha_1 \alpha_2). \]
The initial condition of the recursion is \(c_{\alpha_2}^{(-M_1-1)}(m) = 0\) for any \(m\).

The transformation is based on the cascade of all-pass networks. For more detail, see [1]. Note that the above recursion can be represented as a linear transformation, i.e., matrix multiplication.

[1] A. Oppenheim and D. Johnson, “Discrete representation of signals,” Proc. of the IEEE, vol. 60, no. 6, pp. 681-691, 1972.

[2] K. Tokuda, T. Kobayashi, T. Masuko, and S. Imai, “Mel-generalized cepstral representation of speech - A unified approach to speech spectral estimation,” Proc. of ICSLP 1994, pp. 1043-1046, 1994.

Public Functions

FrequencyTransform(int num_input_order, int num_output_order, double alpha)
Parameters
  • num_input_order[in] Order of input, \(M_1\).

  • num_output_order[in] Order of output, \(M_2\).

  • alpha[in] Frequency warping factor, \(\alpha\).

inline int GetNumInputOrder() const
Returns

Order of input.

inline int GetNumOutputOrder() const
Returns

Order of output.

inline double GetAlpha() const
Returns

Frequency warping factor.

inline bool IsValid() const
Returns

True if this object is valid.

bool Run(const std::vector<double> &minimum_phase_sequence, std::vector<double> *warped_sequence, FrequencyTransform::Buffer *buffer) const
Parameters
  • minimum_phase_sequence[in] \(M_1\)-th order input sequence.

  • warped_sequence[out] \(M_2\)-th order output sequence.

  • buffer[out] Buffer.

Returns

True on success, false on failure.

class Buffer

Buffer for FrequencyTransform class.