phase#
- class diffsptk.Phase(fft_length, unwrap=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=None, a=None)[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=None, a=None, *, fft_length=512, unwrap=False)[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].