mglsp2sp
Functions
-
int main(int argc, char *argv[])
mglsp2sp [ option ] [ infile ]
-m int
order of line spectral pairs \((0 \le M)\)
-a double
all-pass constant \((|\alpha| < 1)\)
-g double
gamma \((-1.0 \le \gamma < 0)\)
-c int
gamma \(\gamma = -1 / C\) \((1 \le C)\)
-l int
FFT length \((1 \le L)\)
-s double
sampling rate \((0 < F_s)\)
-k int
input gain type
0
linear gain1
log gain2
without gain
-q int
input format
0
frequency in rad1
frequency in \(\pi\) rad2
frequency in kHz3
frequency in Hz
-o int
output format
0
\(20 \log_{10}|H(z)|\)1
\(\log|H(z)|\)2
\(|H(z)|\)3
\(|H(z)|^2\)
infile str
double-type mel-LSP
stdout
double-type spectrum
- Parameters:
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns:
0 on success, 1 on failure.
See also
-
class MelGeneralizedLineSpectralPairsToSpectrum
Convert mel-LSP to spectrum.
The input is the \(M\)-th order line spectral paris:
\[ \begin{array}{cccc} K, & \omega(1), & \ldots, & \omega(M), \end{array} \]where \(K\) is the gain. The output is the \((L/2+1)\)-length log amplitude spectrum:\[ \begin{array}{cccc} \log|H(0)|, & \log|H(1)|, & \ldots, & \log|H(L/2)|, \end{array} \]where \(L\) is the FFT length.The transfer function of the all-pole filter is given by
\[ H(z) = K \cdot A^{1/\gamma}(z). \]Thus,\[ \log |H(z)| = \log K + \frac{1}{2\gamma} \log |A(z)|^2. \]If \(M\) is even,\[\begin{split}\begin{eqnarray} |A(\omega)|^2 &=& 2^{M} \left\{ \cos^2 \left( \frac{\tilde{\omega}}{2} \right) \prod_{m=1,3,\ldots}^{M} (\cos\tilde{\omega}-\cos\omega(m))^2 \right. \\ && \left. + \sin^2 \left( \frac{\tilde{\omega}}{2} \right) \prod_{m=2,4,\ldots}^{M} (\cos\tilde{\omega}-\cos\omega(m))^2 \right\}, \end{eqnarray}\end{split}\]else\[\begin{split}\begin{eqnarray} |A(\omega)|^2 &=& 2^{M-1} \left\{ \prod_{m=1,3,\ldots}^{M} (\cos\tilde{\omega}-\cos\omega(m))^2 \right. \\ && \left. + \sin^2 \tilde{\omega} \prod_{m=2,4,\ldots}^{M} (\cos\tilde{\omega}-\cos\omega(m))^2 \right\}, \end{eqnarray}\end{split}\]where \(\tilde{\omega}\) is the angular frequency warped by the first-order all pass filter:\[ \tilde{\omega} = \omega + 2\tan^{-1} \left( \frac{\alpha\sin\omega}{1 - \alpha\cos\omega} \right). \][1] A. V. Oppenheim and D. H. Johnson, “Discrete representation of signals,” Proc. of the IEEE, vol. 60, no. 6, pp. 681-691, 1972.
[2] N. Sugamura and F. Itakura, “Speech data compression by LSP speech analysis-synthesis technique,” Journal of IEICE, vol. J64-A, no. 8, pp. 599-606, 1981.
Public Functions
-
MelGeneralizedLineSpectralPairsToSpectrum(int num_order, double alpha, double gamma, int fft_length)
- Parameters:
num_order – [in] Order of line spectral pairs, \(M\).
alpha – [in] Alpha, \(\alpha\).
gamma – [in] Gamma, \(\gamma\).
fft_length – [in] FFT length, \(L\).
-
inline int GetNumOrder() const
- Returns:
Order of coefficients.
-
inline double GetAlpha() const
- Returns:
Alpha.
-
inline double GetGamma() const
- Returns:
Gamma.
-
inline int GetFftLength() const
- Returns:
FFT length.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
bool Run(const std::vector<double> &line_spectral_pairs, std::vector<double> *spectrum) const
- Parameters:
line_spectral_pairs – [in] \(M\)-th order line spectral pairs. The first element is linear gain and the other elements are in normalized frequency \((0, \pi)\).
spectrum – [out] \((L/2+1)\)-length log amplitude spectrum.
- Returns:
True on success, false on failure.
-
MelGeneralizedLineSpectralPairsToSpectrum(int num_order, double alpha, double gamma, int fft_length)