smcep
Functions
-
int main(int argc, char *argv[])
smcep [ option ] [ infile ]
-m int
order of coefficients \((0 \le M)\)
-a double
all-pass constant \((|\alpha| < 1)\)
-t double
emphasized frequency in \(\pi\) rad \((0 \le \theta \le 1.0)\)
-l int
FFT length \((2 \le N)\)
-q int
input format
0
amplitude spectrum in dB1
log amplitude spectrum2
amplitude spectrum3
power spectrum4
windowed waveform
-f int
accuracy factor \((1 \le F)\)
-i int
number of iterations \((0 \le J)\)
-d double
convergence threshold \((0 \le \epsilon)\)
-e double
small value added to power spectrum
-E double
relative floor in decibels
infile str
double-type windowed sequence or spectrum
stdout
double-type mel-cepstral coefficients
In the example below, mel-cepstral coefficients are extracted from
data.d
.frame < data.d | window | smcep -t 0.12 > data.mcep
- Parameters:
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns:
0 on success, 1 on failure.
See also
-
class SecondOrderAllPassMelCepstralAnalysis
Calculate mel-cepstrum from periodogram.
The input is the half of periodogram:
\[ \begin{array}{cccc} |X(0)|^2, & |X(1)|^2, & \ldots, & |X(N/2)|^2, \end{array} \]where \(N\) is the FFT length. The output is the \(M\)-th order mel-cepstral coefficients:\[ \begin{array}{cccc} \tilde{c}(0), & \tilde{c}(1), & \ldots, & \tilde{c}(M). \end{array} \]In the mel-cepstral analysis based on the second order all-pass function, the spectrum of speech signal is modeled by \(M\)-th order mel-cepstral coefficients as follows:
\[ H(z) = \exp \sum_{m=0}^M \tilde{c}(m) \displaystyle\frac{A^m(z) + A^m(z^{-1})}{2}, \]where\[ A(z) = \left( \frac{z^{-2} - 2\alpha\cos\theta z^{-1} + \alpha^2} {1 - 2\alpha \cos\theta z^{-1} + \alpha^2 z^{-2}} \right)^{1/2}. \]The phase characteristic of the all-pass function is controlled by the two parameters: \(\alpha\) and \(\theta\).Note that the implemenation is based on an unpublished paper.
Public Functions
-
SecondOrderAllPassMelCepstralAnalysis(int fft_length, int num_order, int accuracy_factor, double alpha, double theta, int num_iteration, double convergence_threshold)
- Parameters:
fft_length – [in] Number of FFT bins, \(N\).
num_order – [in] Order of cepstral coefficients, \(M\).
accuracy_factor – [in] Accuracy of frequency transform. This must be a power of two.
alpha – [in] Frequency warping factor, \(\alpha\).
theta – [in] Frequency emphasis factor, \(\theta\).
num_iteration – [in] Number of iterations of Newton method, \(J\).
convergence_threshold – [in] Convergence threshold, \(\epsilon\).
-
inline int GetFftLength() const
- Returns:
FFT length.
-
inline int GetNumOrder() const
- Returns:
Order of coefficients.
-
inline double GetAlpha() const
- Returns:
All-pass constant.
-
inline double GetTheta() const
- Returns:
Frequency emphasis factor.
-
inline int AccuracyFactor() const
- Returns:
A factor for making a conversion matrix of frequency transform.
-
inline int GetNumIteration() const
- Returns:
Number of iterations.
-
inline double GetConvergenceThreshold() const
- Returns:
Convergence threshold.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
bool Run(const std::vector<double> &periodogram, std::vector<double> *mel_cepstrum, SecondOrderAllPassMelCepstralAnalysis::Buffer *buffer) const
- Parameters:
periodogram – [in] \((N/2+1)\)-length periodogram.
mel_cepstrum – [out] \(M\)-th order mel-cepstral coefficients.
buffer – [out] Buffer.
- Returns:
True on success, false on failure.
-
class Buffer
Buffer for SecondOrderAllPassMelCepstralAnalysis class.
-
SecondOrderAllPassMelCepstralAnalysis(int fft_length, int num_order, int accuracy_factor, double alpha, double theta, int num_iteration, double convergence_threshold)
-
class SecondOrderAllPassFrequencyTransform
Transform a minimum phase sequence into a frequency-warped sequence.
Public Functions
-
SecondOrderAllPassFrequencyTransform(int num_input_order, int num_output_order, int fft_length, double alpha, double theta)
- Parameters:
num_input_order – [in] Order of input, \(M_1\).
num_output_order – [in] Order of output, \(M_2\).
fft_length – [in] FFT length used to make conversion matrix.
alpha – [in] Frequency warping factor, \(\alpha\).
theta – [in] Frequency emphasis factor, \(\theta\).
-
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 double GetTheta() const
- Returns:
Frequency emphasis 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) const
- Parameters:
minimum_phase_sequence – [in] \(M_1\)-th order input sequence.
warped_sequence – [out] \(M_2\)-th order output sequence.
- Returns:
True on success, false on failure.
-
SecondOrderAllPassFrequencyTransform(int num_input_order, int num_output_order, int fft_length, double alpha, double theta)
-
class SecondOrderAllPassInverseFrequencyTransform
Transform a frequency-warped sequence into a minimum phase sequence.
Public Functions
-
SecondOrderAllPassInverseFrequencyTransform(int num_input_order, int num_output_order, int fft_length, double alpha, double theta)
- Parameters:
num_input_order – [in] Order of input, \(M_1\).
num_output_order – [in] Order of output, \(M_2\).
fft_length – [in] FFT length used to make conversion matrix.
alpha – [in] Frequency warping factor, \(\alpha\).
theta – [in] Frequency emphasis factor, \(\theta\).
-
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 double GetTheta() const
- Returns:
Frequency emphasis factor.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
bool Run(const std::vector<double> &warped_sequence, std::vector<double> *minimum_phase_sequence) const
- Parameters:
warped_sequence – [in] \(M_1\)-th order input sequence.
minimum_phase_sequence – [out] \(M_2\)-th order output sequence.
- Returns:
True on success, false on failure.
-
SecondOrderAllPassInverseFrequencyTransform(int num_input_order, int num_output_order, int fft_length, double alpha, double theta)