mlsacheck

Functions

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

mlsacheck [ option ] [ infile ]

  • -m int

    • order of mel-cepstrum \((0 \le M)\)

  • -l int

    • FFT length \((M < L)\)

  • -a double

    • all-pass constant \((|\alpha| < 1)\)

  • -P int

    • order of Pade approximation \((4 \le P \le 7)\)

  • -e int

    • warning type

      • 0 no warning

      • 1 output index

      • 2 output index and exit immediately

  • -R double

    • threshold value \((0 < R)\)

  • -r int

    • stability condition

      • 0 keep maximum log approximation error

      • 1 keep filter stability

  • -t int

    • modification type

      • 0 clipping

      • 1 scaling

  • -f

    • fast mode

  • -x

    • perform modification

  • infile str

    • double-type mel-cepstrum

  • stdout

    • double-type modified mel-cepstrum

If -R option is not specified, the threshold value is automatically determined according to the below table.

P

R (r=0)

R (r=1)

E_max [dB]

4

4.5

6.20

0.24

5

6.0

7.65

0.27

6

7.4

9.13

0.25

7

8.9

10.60

0.26

In the following example, the stability of MLSA filter of 49-th order mel-cepstral coefficients read from data.mcep are checked and modified:

mlsacheck -m 49 -a 0.55 -P 5 -l 4096 -r 1 -x data.mcep > data2.mcep
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

class MlsaDigitalFilterStabilityCheck

Check stability of mel-cepstral coefficients and modify them.

The input is the \(M\)-th order mel-cepstrum:

\[ \begin{array}{cccc} K, & \tilde{c}(1), & \ldots, & \tilde{c}(M), \end{array} \]
and the output is the modified \(M\)-th order mel-cepstrum:
\[ \begin{array}{cccc} K, & \tilde{c}'(1), & \ldots, & \tilde{c}'(M). \end{array} \]

In the mel-cepstral analysis, spectral envelope is modeled by \(M\)-th order mel-cepstral coefficients:

\[ H(z) = \exp \sum_{m=0}^M \tilde{c}(m) \tilde{z}^{-m} \]
where
\[ \tilde{z}^{-1} = \frac{z^{-1} - \alpha}{1 - \alpha z^{-1}}. \]
The \(H(z)\) can be decomposed as \(K \cdot D(z)\) where
\[\begin{split}\begin{eqnarray} K &=& \exp \, b(0), \\ D(z) &=& \exp \sum_{m=1}^M b(m) \varPhi_m(z), \end{eqnarray}\end{split}\]
and
\[\begin{split} \varPhi_m(z) = \left\{ \begin{array}{ll} 1, & m = 0 \\ \displaystyle\frac{(1 - \alpha^2)z^{-1}}{1 - \alpha z^{-1}} \tilde{z}^{-(m - 1)}. & m > 0 \end{array} \right. \end{split}\]
The exponential transfer function \(D(z)\) is implemented by an \(L\)-th order rational function \(R_L(\cdot)\) using the modified Pade approximation:
\[ D(z) \equiv \exp F(z) \simeq R_L(F(z)) \]
where
\[ F(z) = \sum_{m=1}^M b(m) \varPhi_m(z). \]
The stability of the MLSA digital filter can be checked by the maximum magnitude of the basic filter \(F(z)\). It can be simply obtained by applying the fast Fourier transform to the gain normalized mel-cepstrum sequence. In addition, by assuming that the amplitude spectrum of human speech at zero frequency usually takes maximum value, we can check the stability without FFT.

Public Types

enum ModificationType

Type of modification.

Values:

enumerator kClipping
enumerator kScaling
enumerator kNumModificationTypes

Public Functions

MlsaDigitalFilterStabilityCheck(int num_order, double alpha, double threshold)
Parameters:
  • num_order[in] Order of mel-cepstrum, \(M\).

  • alpha[in] All-pass constant, \(\alpha\).

  • threshold[in] Threshold value.

MlsaDigitalFilterStabilityCheck(int num_order, double alpha, double threshold, int fft_length, ModificationType modification_type)
Parameters:
  • num_order[in] Order of mel-cepstrum, \(M\).

  • alpha[in] All-pass constant, \(\alpha\).

  • threshold[in] Threshold value.

  • fft_length[in] FFT length (valid if fast_mode is true).

  • modification_type[in] Type of modification.

inline int GetNumOrder() const
Returns:

Order of coefficients.

inline double GetAlpha() const
Returns:

All-pass constant.

inline double GetThreshold() const
Returns:

Threshold value.

inline bool GetFastModeFlag() const
Returns:

True if fast mode is on.

inline int GetFftLength() const
Returns:

FFT length.

inline ModificationType GetModificationType() const
Returns:

Type of modification.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const std::vector<double> &mel_cepstrum, std::vector<double> *modified_mel_cepstrum, bool *is_stable, double *maximum_amplitude_of_basic_filter, MlsaDigitalFilterStabilityCheck::Buffer *buffer) const
Parameters:
  • mel_cepstrum[in] \(M\)-th order mel-cepstrum.

  • modified_mel_cepstrum[out] Modified \(M\)-th order mel-cepstrum (optional).

  • is_stable[out] True if the given coefficients are stable.

  • maximum_amplitude_of_basic_filter[out] Maximum amplitude (optional).

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

bool Run(std::vector<double> *input_and_output, bool *is_stable, double *maximum_amplitude_of_basic_filter, MlsaDigitalFilterStabilityCheck::Buffer *buffer) const
Parameters:
  • input_and_output[inout] \(M\)-th order coefficients.

  • is_stable[out] True if the given coefficients are stable.

  • maximum_amplitude_of_basic_filter[out] Maximum amplitude (optional).

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

class Buffer

Buffer of MlsaDigitalFilterStabilityCheck.