df2#
- class diffsptk.SecondOrderDigitalFilter(sample_rate, pole_frequency=None, pole_bandwidth=None, zero_frequency=None, zero_bandwidth=None, ir_length=None)[source]#
See this page for details.
- Parameters:
- sample_rateint >= 1 [scalar]
Sample rate in Hz.
- pole_frequencyfloat > 0 [scalar]
Pole frequency in Hz.
- pole_bandwidthfloat > 0 [scalar]
Pole bandwidth in Hz.
- zero_frequencyfloat > 0 [scalar]
Zero frequency in Hz.
- zero_bandwidthfloat > 0 [scalar]
Zero bandwidth in Hz.
- ir_lengthint >= 1 [scalar]
Length of impulse response.
- forward(x)[source]#
Apply a second order digital filter.
- Parameters:
- xTensor [shape=(B, 1, T) or (B, T) or (T,)]
Input waveform.
- Returns:
- yTensor [shape=(B, 1, T) or (B, T) or (T,)]
Filterd 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