mgc2sp#

class diffsptk.MelGeneralizedCepstrumToSpectrum(cep_order, fft_length, alpha=0, gamma=0, norm=False, mul=False, out_format='power', n_fft=512)[source]#

See this page for details.

Parameters:
cep_orderint >= 0 [scalar]

Order of mel-cepstrum, \(M\).

fft_lengthint >= 2 [scalar]

Number of FFT bins, \(L\).

alphafloat [-1 < alpha < 1]

Warping factor, \(\alpha\).

gammafloat [-1 <= gamma <= 1]

Gamma, \(\gamma\).

normbool [scalar]

If True, assume normalized cepstrum.

mulbool [scalar]

If True, assume gamma-multiplied cepstrum.

out_format[‘db’, ‘log-magnitude’, ‘magnitude’, ‘power’, ‘cycle’, ‘radian’, ‘degree’, ‘complex’]

Output format.

n_fftint >> \(L\) [scalar]

Number of FFT bins. Accurate conversion requires the large value.

forward(mc)[source]#

Convert mel-cepstrum to spectrum.

Parameters:
mcTensor [shape=(…, M+1)]

Mel-cepstrum.

Returns:
spTensor [shape=(…, L/2+1)]

Amplitude spectrum or phase 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]])

See also

mgc2mgc