df2#

class diffsptk.SecondOrderDigitalFilter(sample_rate, pole_frequency=None, pole_bandwidth=None, zero_frequency=None, zero_bandwidth=None, **kwargs)[source]#

See this page for details.

Parameters:
sample_rateint >= 1

Sample rate in Hz.

pole_frequencyfloat > 0

Pole frequency in Hz.

pole_bandwidthfloat > 0

Pole bandwidth in Hz.

zero_frequencyfloat > 0

Zero frequency in Hz.

zero_bandwidthfloat > 0

Zero bandwidth in Hz.

**kwargsadditional keyword arguments

See InfiniteImpulseResponseDigitalFilter().

forward(x)[source]#

Apply a second order digital filter.

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

Input waveform.

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

Filtered waveform.

Examples

>>> x = diffsptk.ramp(4)
>>> df2 = diffsptk.SecondOrderDigitalFilter(16000, 100, 200, 1000, 50, 5)
>>> y = df2(x)
>>> y
tensor([0.0000, 1.0000, 2.0918, 3.4161, 5.1021])

See also

dfs