smcep#

class diffsptk.SecondOrderAllPassMelCepstralAnalysis(cep_order, fft_length, alpha=0, theta=0, n_iter=0, accuracy_factor=4)[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\).

thetafloat [0 <= theta <= 1]

Emphasis frequency, \(\theta\).

n_iterint >= 0 [scalar]

Number of iterations.

accuracy_factorint >= 1 [scalar]

Accuracy factor multiplied by FFT length.

forward(x)[source]#

Estimate mel-cepstrum from spectrum.

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

Power spectrum.

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

Mel-cepstrum.

Examples

>>> x = diffsptk.ramp(19)
>>> stft = diffsptk.STFT(frame_length=10, frame_period=10, fft_length=16)
>>> smcep = diffsptk.SecondOrderAllPassMelCepstralAnalysis(3, 16, 0.1, n_iter=1)
>>> mc = smcep(stft(x))
>>> mc
tensor([[-0.8851,  0.7917, -0.1737,  0.0175],
        [-0.3523,  4.4223, -1.0883, -0.0510]])