mgcep#

diffsptk.MelCepstralAnalysis#

alias of MelGeneralizedCepstralAnalysis

class diffsptk.MelGeneralizedCepstralAnalysis(cep_order, fft_length, alpha=0, gamma=0, n_iter=0)[source]#

See this page for details. Note that the current implementation does not use the efficient Toeplitz-plus-Hankel system solver.

Parameters:
cep_orderint >= 0

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

fft_lengthint >= 2M

Number of FFT bins, \(L\).

alphafloat in (-1, 1)

Frequency warping factor, \(\alpha\).

gammafloat in [-1, 0]

Gamma, \(\gamma\).

n_iterint >= 0

Number of iterations.

forward(x)[source]#

Estimate mel-generalized cepstrum from spectrum.

Parameters:
xTensor [shape=(…, L/2+1)]

Power spectrum.

Returns:
outTensor [shape=(…, M+1)]

Mel-generalized cepstrum.

Examples

>>> x = diffsptk.ramp(19)
>>> stft = diffsptk.STFT(frame_length=10, frame_period=10, fft_length=16)
>>> mgcep = diffsptk.MelGeneralizedCepstralAnalysis(3, 16, 0.1, n_iter=1)
>>> mc = mgcep(stft(x))
>>> mc
tensor([[-0.8851,  0.7917, -0.1737,  0.0175],
        [-0.3522,  4.4222, -1.0882, -0.0511]])