mgcep#
- class diffsptk.MelCepstralAnalysis(*, fft_length: int, cep_order: int, alpha: float = 0, n_iter: int = 0)[source]#
See this page for details. Note that the current implementation does not use the efficient Toeplitz-plus-Hankel system solver.
- Parameters:
- fft_lengthint >= 2M
The number of FFT bins, \(L\).
- cep_orderint >= 0
The order of the cepstrum, \(M\).
- alphafloat in (-1, 1)
The frequency warping factor, \(\alpha\).
- n_iterint >= 0
The number of iterations.
- forward(x: Tensor)[source]#
Perform mel-cepstral analysis.
- Parameters:
- xTensor [shape=(…, L/2+1)]
The power spectrum.
- Returns:
- outTensor [shape=(…, M+1)]
The mel-cepstrum.
Examples
>>> x = diffsptk.ramp(19) >>> stft = diffsptk.STFT(frame_length=10, frame_period=10, fft_length=16) >>> mcep = diffsptk.MelCepstralAnalysis( ... fft_length=16, cep_order=3, alpha=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]])
- diffsptk.functional.mcep(x: Tensor, cep_order: int, alpha: float = 0, n_iter: int = 0) Tensor [source]#
Perform mel-cepstral analysis.
- Parameters:
- xTensor [shape=(…, L/2+1)]
The power spectrum.
- cep_orderint >= 0
The order of the cepstrum, \(M\).
- alphafloat in (-1, 1)
The frequency warping factor, \(\alpha\).
- n_iterint >= 0
The number of iterations.
- Returns:
- outTensor [shape=(…, M+1)]
The mel-cepstrum.
- class diffsptk.MelGeneralizedCepstralAnalysis(*, fft_length: int, cep_order: int, alpha: float = 0, gamma: float = 0, c: int | None = None, n_iter: int = 0)[source]#
See this page for details. Note that the current implementation does not use the efficient Toeplitz-plus-Hankel system solver.
- Parameters:
- fft_lengthint >= 2M
The number of FFT bins, \(L\).
- cep_orderint >= 0
The order of the mel-cepstrum, \(M\).
- alphafloat in (-1, 1)
The frequency warping factor, \(\alpha\).
- gammafloat in [-1, 0]
The gamma parameter, \(\gamma\).
- cint >= 1 or None
The number of stages.
- n_iterint >= 0
THe number of iterations.
- forward(x: Tensor) Tensor [source]#
Estimate mel-generalized cepstrum from spectrum.
- Parameters:
- xTensor [shape=(…, L/2+1)]
The power spectrum.
- Returns:
- outTensor [shape=(…, M+1)]
The mel-generalized cepstrum.
Examples
>>> x = diffsptk.ramp(19) >>> stft = diffsptk.STFT(frame_length=10, frame_period=10, fft_length=16) >>> mgcep = diffsptk.MelGeneralizedCepstralAnalysis( ... fft_length=16, cep_order=3, alpha=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]])