phase#

class diffsptk.Phase(fft_length, unwrap=False)[source]#

See this page for details.

Parameters:
fft_lengthint >= 2

Number of FFT bins, \(L\).

unwrapbool

If True, perform phase unwrapping.

forward(b=None, a=None)[source]#

Compute phase spectrum.

Parameters:
bTensor [shape=(…, M+1)] or None

Numerator coefficients.

aTensor [shape=(…, N+1)] or None

Denominator coefficients.

Returns:
outTensor [shape=(…, L/2+1)]

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

Numerator coefficients.

aTensor [shape=(…, N+1)] or None

Denominator coefficients.

fft_lengthint >= 2

Number of FFT bins, \(L\).

unwrapbool

If True, perform phase unwrapping.

Returns:
outTensor [shape=(…, L/2+1)]

Phase spectrum [\(\pi\) rad].

See also

spec grpdelay