mgc2mgc

Functions

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

mgc2mgc [ option ] [ infile ]

  • -m int

    • order of input coefficients \((0 \le M_1)\)

  • -a double

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

  • -g double

    • input gamma \((|\gamma_1| \le 1)\)

  • -c int

    • input gamma \(\gamma_1 = -1 / C_1\) \((1 \le C_1)\)

  • -n

    • regard input as normalized mel-generalized cepstrum

  • -u

    • regard input as multiplied by gamma

  • -M int

    • order of output coefficients \((0 \le M_2)\)

  • -A double

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

  • -G double

    • output gamma \((|\gamma_2| \le 1)\)

  • -C int

    • output gamma \(\gamma_2 = -1 / C_2\) \((1 \le C_2)\)

  • -N

    • regard output as normalized mel-generalized cepstrum

  • -U

    • regard output as multiplied by gamma

  • infile str

    • double-type mel-generalized cepstral coefficients

  • stdout

    • double-type converted mel-generalized cepstral coefficients

If -u without -n, the 0th input is regarded as \(1 + \gamma_1 c_{\alpha_1,\gamma_1}(0)\). If -U without -N, the 0th output is regarded as \(1 + \gamma_2 c_{\alpha_2,\gamma_2}(0)\).

In the example below, 12-th order LPC coefficients in data.lpc are converted to 30-th order mel-cepstral coefficients.

mgc2mgc -m 12 -a 0 -g -1 -M 30 -A 0.31 -G 0 < data.lpc > data.mcep

Impulse response can be calculated using this command instead of c2mpir.

mgc2mgc -m 10 -a 0.4 -g 0 -M 30 -A 0.0 -G 1 -U < data.mcep > data.ir
# This is equivalent to that:
# freqt -a 0.4 -A 0.0 -m 10 -M 30 data.mcep | c2mpir -m 30 -M 30 > data.ir
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

mgcep freqt gnorm ignorm

class MelGeneralizedCepstrumToMelGeneralizedCepstrum

Convert mel-generalized cepstrum to mel-generalized cepstrum.

The input and output are in one of the following forms:

(1) gain normalized + gamma multiplied

\[ \begin{array}{cccc} K_{\alpha,\gamma}, & \gamma c'_{\alpha,\gamma}(1), & \ldots, & \gamma c'_{\alpha,\gamma}(M), \end{array} \]
(2) gain normalized
\[ \begin{array}{cccc} K_{\alpha,\gamma}, & c'_{\alpha,\gamma}(1), & \ldots, & c'_{\alpha,\gamma}(M), \end{array} \]
(3) gain unnormalized + gamma multiplied
\[ \begin{array}{cccc} c_{\alpha,\gamma}(0), & \gamma c_{\alpha,\gamma}(1), & \ldots, & \gamma c_{\alpha,\gamma}(M), \end{array} \]
(4) gain unnormalized
\[ \begin{array}{cccc} c_{\alpha,\gamma}(0), & c_{\alpha,\gamma}(1), & \ldots, & c_{\alpha,\gamma}(M), \end{array} \]
where \(M\) is the order of cepstrum. The conversion process is as follows:

  1. Convert input to gain unnormalized form.

    \[ \begin{array}{cccc} c_{\alpha_1,\gamma_1}(0), & c_{\alpha_1,\gamma_1}(1), & \ldots, & c_{\alpha_1,\gamma_1}(M_1), \end{array} \]

  2. Perform frequency transform.

    \[ \begin{array}{cccc} c_{\alpha_2,\gamma_1}(0), & c_{\alpha_2,\gamma_1}(1), & \ldots, & c_{\alpha_2,\gamma_1}(M_2), \end{array} \]

  3. Perform gain normalization.

    \[ \begin{array}{cccc} K_{\alpha_2,\gamma_1}, & c'_{\alpha_2,\gamma_1}(1), & \ldots, & c'_{\alpha_2,\gamma_1}(M_2), \end{array} \]

  4. Calculate

    \[ \begin{array}{cccc} K_{\alpha_2,\gamma_2}, & c'_{\alpha_2,\gamma_2}(1), & \ldots, & c'_{\alpha_2,\gamma_2}(M_2), \end{array} \]
    using the generalized log transformation:
    \[ c'_{\alpha_2,\gamma_2}(m) = c'_{\alpha_2,\gamma_1}(m) + \sum_{k=1}^{m-1} \frac{k}{m} \left\{ \gamma_2 c_{\alpha_2,\gamma_1}(k) \, c'_{\alpha_2,\gamma_2}(m-k) -\gamma_1 c'_{\alpha_2,\gamma_2}(k) \, c_{\alpha_2,\gamma_1}(m-k) \right\}. \]

  5. Convert the output to one of the four form.

Public Functions

MelGeneralizedCepstrumToMelGeneralizedCepstrum(int num_input_order, double input_alpha, double input_gamma, bool is_normalized_input, bool is_multiplied_input, int num_output_order, double output_alpha, double output_gamma, bool is_normalized_output, bool is_multiplied_output)
Parameters:
  • num_input_order[in] Order of input, \(M_1\).

  • input_alpha[in] Input alpha, \(\alpha_1\).

  • input_gamma[in] Input gamma, \(\gamma_1\).

  • is_normalized_input[in] Input gain-normalized flag.

  • is_multiplied_input[in] Input gamma-multiplied flag.

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

  • output_alpha[in] Output alpha, \(\alpha_2\).

  • output_gamma[in] Output gamma, \(\gamma_2\).

  • is_normalized_output[in] Output gain-normalized flag.

  • is_multiplied_output[in] Output gamma-multiplied flag.

inline int GetNumInputOrder() const
Returns:

Order of input.

inline double GetInputAlpha() const
Returns:

Input alpha.

inline double GetInputGamma() const
Returns:

Input gamma.

inline bool IsNormalizedInput() const
Returns:

True if input is gain-normalized.

inline bool IsMultipliedInput() const
Returns:

True if input is muliplied by gamma.

inline int GetNumOutputOrder() const
Returns:

Order of output.

inline double GetOutputAlpha() const
Returns:

Output alpha.

inline double GetOutputGamma() const
Returns:

Output gamma.

inline bool IsNormalizedOutput() const
Returns:

True if output is gain-normalized.

inline bool IsMultipliedOutput() const
Returns:

True if output is muliplied by gamma.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const std::vector<double> &input, std::vector<double> *output, MelGeneralizedCepstrumToMelGeneralizedCepstrum::Buffer *buffer) const
Parameters:
  • input[in] \(M_1\)-th order mel-generalized cepstrum.

  • output[out] \(M_2\)-th order mel-generalized cepstrum.

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

class Buffer

Buffer for MelGeneralizedCepstrumToMelGeneralizedCepstrum class.

class ModuleInterface

Module interface.

Public Functions

virtual bool IsValid() const = 0
Returns:

True if this object is valid.

virtual bool Run(const std::vector<double> &input, std::vector<double> *output, FrequencyTransform::Buffer *frequency_transform_buffer) const = 0
Parameters:
  • input[in] Input.

  • output[out] Output.

  • frequency_transform_buffer[out] Buffer for frequency transform.

Returns:

True on success, false on failure.