hilbert#

class diffsptk.HilbertTransform(fft_length, dim=-1)[source]#

Hilbert transform module.

Parameters:
fft_lengthint >= 1

The number of FFT bins.

dimint

The dimension along which to take the Hilbert transform.

forward(x)[source]#

Compute the analytic signal using the Hilbert transform.

Parameters:
xTensor [shape=(…, T, …)]

The input signal.

Returns:
outTensor [shape=(…, T, …)]

The analytic signal, where the real part is the input signal and the imaginary part is the Hilbert transform of the input signal.

Examples

>>> x = diffsptk.nrand(3)
>>> x
tensor([ 1.1809, -0.2834, -0.4169,  0.3883])
>>> hilbert = diffsptk.HilbertTransform(4)
>>> z = hilbert(x)
>>> z.real
tensor([ 1.1809, -0.2834, -0.4169,  0.3883])
>>> z.imag
tensor([ 0.3358,  0.7989, -0.3358, -0.7989])
diffsptk.functional.hilbert(x, fft_length=None, dim=-1)[source]#

Compute the analytic signal using the Hilbert transform.

Parameters:
xTensor [shape=(…, T, …)]

The input signal.

fft_lengthint >= 1 or None

The number of FFT bins. If None, set to T.

dimint

The dimension along which to take the Hilbert transform.

Returns:
outTensor [shape=(…, T, …)]

The analytic signal.

See also

hilbert2