mgc2sp#
- class diffsptk.MelGeneralizedCepstrumToSpectrum(cep_order, fft_length, *, alpha=0, gamma=0, norm=False, mul=False, n_fft=512, out_format='power')[source]#
See this page for details.
- Parameters:
- cep_orderint >= 0
The order of the mel-cepstrum, \(M\).
- fft_lengthint >= 2
The number of FFT bins, \(L\).
- alphafloat in (-1, 1)
The frequency warping factor, \(\alpha\).
- gammafloat in [-1, 1]
The gamma parameter, \(\gamma\).
- normbool
If True, the input is assumed to be normalized.
- mulbool
If True, the input is assumed to be gamma-multiplied.
- n_fftint >> L
The number of FFT bins. Accurate conversion requires a large value.
- out_format[‘db’, ‘log-magnitude’, ‘magnitude’, ‘power’, ‘cycle’, ‘radian’, ‘degree’, ‘complex’]
The output format.
- forward(mc)[source]#
Convert mel-cepstrum to spectrum.
- Parameters:
- mcTensor [shape=(…, M+1)]
Mel-cepstrum.
- Returns:
- outTensor [shape=(…, L/2+1)]
Spectrum.
Examples
>>> x = diffsptk.ramp(19) >>> stft = diffsptk.STFT(frame_length=10, frame_period=10, fft_length=16) >>> mcep = diffsptk.MelCepstralAnalysis(3, 16, 0.1, n_iter=1) >>> mc = mcep(stft(x)) >>> mc tensor([[-0.8851, 0.7917, -0.1737, 0.0175], [-0.3522, 4.4222, -1.0882, -0.0511]]) >>> mc2sp = diffsptk.MelGeneralizedCepstrumToSpectrum(3, 8, 0.1) >>> sp = mc2sp(mc) >>> sp tensor([[6.0634e-01, 4.6702e-01, 1.7489e-01, 4.4821e-02, 2.3869e-02], [3.5677e+02, 1.9435e+02, 6.0078e-01, 2.4278e-04, 8.8537e-06]])
- diffsptk.functional.mgc2sp(mc, fft_length, alpha=0, gamma=0, norm=False, mul=False, n_fft=512, out_format='power')[source]#
Convert mel-cepstrum to spectrum.
- Parameters:
- mcTensor [shape=(…, M+1)]
Mel-cepstrum.
- fft_lengthint >= 2
The number of FFT bins, \(L\).
- alphafloat in (-1, 1)
The frequency warping factor, \(\alpha\).
- gammafloat in [-1, 1]
The gamma parameter, \(\gamma\).
- normbool
If True, the input is assumed to be normalized.
- mulbool
If True, the input is assumed to be gamma-multiplied.
- n_fftint >> L
The number of FFT bins.
- out_format[‘db’, ‘log-magnitude’, ‘magnitude’, ‘power’, ‘cycle’, ‘radian’, ‘degree’, ‘complex’]
The output format.
- Returns:
- outTensor [shape=(…, L/2+1)]
Spectrum.
See also