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 [scalar]

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

fft_lengthint >= 2M [scalar]

Number of FFT bins, \(L\).

alphafloat [-1 < alpha < 1]

Frequency warping factor, \(\alpha\).

gammafloat [-1 <= gamma <= 0]

Gamma, \(\gamma\).

n_iterint >= 0 [scalar]

Number of iterations.

forward(x)[source]#

Estimate mel-generalized cepstrum from spectrum.

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

Power spectrum.

Returns:
mcTensor [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]])