mglsadf#
- diffsptk.MLSA#
alias of
PseudoMGLSADigitalFilter
- class diffsptk.PseudoMGLSADigitalFilter(filter_order, frame_period, *, alpha=0, gamma=0, c=None, ignore_gain=False, phase='minimum', mode='multi-stage', **kwargs)[source]#
See this page for details.
- Parameters:
- filter_orderint >= 0 [scalar]
Order of filter coefficients, \(M\).
- frame_periodint >= 1 [scalar]
Frame period, \(P\).
- alphafloat [-1 < alpha < 1]
Frequency warping factor, \(\alpha\).
- gammafloat [-1 <= gamma <= 1]
Gamma, \(\gamma\).
- cint >= 1 [scalar]
Number of stages.
- ignore_gainbool [scalar]
If True, perform filtering without gain.
- phase[‘minimum’, ‘maximum’, ‘zero’]
Filter type.
- mode[‘multi-stage’, ‘single-stage’, ‘freq-domain’]
‘multi-stage’ approximates the MLSA filter by cascading FIR filters based on the Taylor series expansion. ‘single-stage’ uses a FIR filter whose coefficients are the impulse response converted from input mel-cepstral coefficients using FFT. ‘freq-domain’ performs filtering in the frequency domain rather than time one.
- taylor_orderint >= 0 [scalar]
Order of Taylor series expansion (valid only if mode is ‘multi-stage’).
- cep_orderint >= 0 [scalar]
Order of linear cepstrum (valid only if mode is ‘multi-stage’).
- ir_lengthint >= 1 [scalar]
Length of impulse response (valid only if mode is ‘single-stage’).
- n_fftint >= 1 [scalar]
Number of FFT bins for conversion (valid only if mode is ‘single-stage’).
- **stft_kwargsadditional keyword arguments
See
ShortTermFourierTransform()
(valid only if mode is ‘freq-domain’).
References
[1]T. Yoshimura et al., “Embedding a differentiable mel-cepstral synthesis filter to a neural speech synthesis system,” arXiv:2211.11222, 2022.
- forward(x, mc)[source]#
Apply an MGLSA digital filter.
- Parameters:
- xTensor [shape=(…, T)]
Excitation signal.
- mcTensor [shape=(…, T/P, M+1)]
Mel-generalized cepstrum, not MLSA digital filter coefficients.
- Returns:
- yTensor [shape=(…, T)]
Output signal.
Examples
>>> M = 4 >>> x = diffsptk.step(3) >>> mc = diffsptk.nrand(2, M) >>> mc tensor([[-0.9134, -0.5774, -0.4567, 0.7423, -0.5782], [ 0.6904, 0.5175, 0.8765, 0.1677, 2.4624]]) >>> mglsadf = diffsptk.MLSA(M, frame_period=2) >>> y = mglsadf(x.view(1, -1), mc.view(1, 2, M + 1)) >>> y tensor([[0.4011, 0.8760, 3.5677, 4.8725]])