espnet2.gan_tts.melgan.pqmf.PQMF
espnet2.gan_tts.melgan.pqmf.PQMF
class espnet2.gan_tts.melgan.pqmf.PQMF(subbands: int = 4, taps: int = 62, cutoff_ratio: float = 0.142, beta: float = 9.0)
Bases: Module
Pseudo QMF modules.
This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN.
The PQMF (Pseudo Quadrature Mirror Filter) module is designed for near-perfect reconstruction filter banks based on the concept of pseudo-QMF banks. It includes methods for both analysis and synthesis of signals using these filter banks.
The implementation uses a Kaiser window approach to design the prototype filters that are fundamental to the PQMF operation.
analysis_filter
Analysis filter coefficients.
- Type: torch.Tensor
synthesis_filter
Synthesis filter coefficients.
- Type: torch.Tensor
updown_filter
Filter for downsampling and upsampling.
- Type: torch.Tensor
subbands
Number of subbands in the PQMF.
Type: int
Parameters:
- subbands (int) – The number of subbands.
- taps (int) – The number of filter taps.
- cutoff_ratio (float) – Cut-off frequency ratio.
- beta (float) – Beta coefficient for Kaiser window.
analysis(x
torch.Tensor) -> torch.Tensor: Applies the analysis operation on the input tensor using PQMF.
synthesis(x
torch.Tensor) -> torch.Tensor: Applies the synthesis operation on the input tensor using PQMF.
Examples
>>> pqmf = PQMF(subbands=4, taps=62, cutoff_ratio=0.142, beta=9.0)
>>> input_tensor = torch.randn(1, 1, 1024) # Example input
>>> analysis_output = pqmf.analysis(input_tensor)
>>> synthesis_output = pqmf.synthesis(analysis_output)
Notes
- The cutoff_ratio and beta parameters are optimized for subbands = 4. See discussion in https://github.com/kan-bayashi/ParallelWaveGAN/issues/195.
- Power will be decreased in the synthesis process, so the output is multiplied by the number of subbands. This approach should be reviewed for correctness.
- Further understanding of the reconstruction procedure is needed (TODO).
Initilize PQMF module.
The cutoff_ratio and beta parameters are optimized for #subbands = 4. See dicussion in https://github.com/kan-bayashi/ParallelWaveGAN/issues/195.
- Parameters:
- subbands (int) – The number of subbands.
- taps (int) – The number of filter taps.
- cutoff_ratio (float) – Cut-off frequency ratio.
- beta (float) – Beta coefficient for kaiser window.
#
analysis(x
Pseudo QMF modules.
This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN.
#
synthesis(x
Pseudo QMF modules.
This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN.