mglsp2sp

Functions

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

mglsp2sp [ option ] [ infile ]

  • -m int

    • order of line spectral pairs (0M)

  • -a double

    • all-pass constant (|α|<1)

  • -g double

    • gamma (1.0γ<0)

  • -c int

    • gamma γ=1/C (1C)

  • -l int

    • FFT length (1L)

  • -s double

    • sampling rate (0<Fs)

  • -k int

    • input gain type

      • 0 linear gain

      • 1 log gain

      • 2 without gain

  • -q int

    • input format

      • 0 frequency in rad

      • 1 frequency in π rad

      • 2 frequency in kHz

      • 3 frequency in Hz

  • -o int

    • output format

      • 0 20log10|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

lpc2lsp

class MelGeneralizedLineSpectralPairsToSpectrum

Convert mel-LSP to spectrum.

The input is the M-th order line spectral paris:

K,ω(1),,ω(M),
where K is the gain. The output is the (L/2+1)-length log amplitude spectrum:
log|H(0)|,log|H(1)|,,log|H(L/2)|,
where L is the FFT length.

The transfer function of the all-pole filter is given by

H(z)=KA1/γ(z).
Thus,
log|H(z)|=logK+12γlog|A(z)|2.
If M is even,
|A(ω)|2=2M{cos2(ω~2)m=1,3,M(cosω~cosω(m))2+sin2(ω~2)m=2,4,M(cosω~cosω(m))2},
else
|A(ω)|2=2M1{m=1,3,M(cosω~cosω(m))2+sin2ω~m=2,4,M(cosω~cosω(m))2},
where ω~ is the angular frequency warped by the first-order all pass filter:
ω~=ω+2tan1(αsinω1αcosω).

[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, α.

  • gamma[in] 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,π).

  • spectrum[out] (L/2+1)-length log amplitude spectrum.

Returns:

True on success, false on failure.