phase#
- class diffsptk.Phase(fft_length: int, unwrap: bool = False)[source]#
See this page for details.
- Parameters:
- fft_lengthint >= 2
The number of FFT bins, \(L\).
- unwrapbool
If True, perform the phase unwrapping.
- forward(b: Tensor | None = None, a: Tensor | None = None) Tensor [source]#
Compute phase spectrum.
- Parameters:
- bTensor [shape=(…, M+1)] or None
The numerator coefficients.
- aTensor [shape=(…, N+1)] or None
The denominator coefficients.
- Returns:
- outTensor [shape=(…, L/2+1)]
The phase spectrum [\(\pi\) rad].
Examples
>>> x = diffsptk.ramp(3) >>> phase = diffsptk.Phase(8) >>> p = phase(x) >>> p tensor([ 0.0000, -0.5907, 0.7500, -0.1687, 1.0000])
- diffsptk.functional.phase(b: Tensor | None = None, a: Tensor | None = None, *, fft_length: int = 512, unwrap: bool = False) Tensor [source]#
Compute phase spectrum.
- Parameters:
- bTensor [shape=(…, M+1)] or None
The numerator coefficients.
- aTensor [shape=(…, N+1)] or None
The denominator coefficients.
- fft_lengthint >= 2
The number of FFT bins, \(L\).
- unwrapbool
If True, perform the phase unwrapping.
- Returns:
- outTensor [shape=(…, L/2+1)]
The phase spectrum [\(\pi\) rad].