torchaudio.functional.filtfilt¶
- torchaudio.functional.filtfilt(waveform: Tensor, a_coeffs: Tensor, b_coeffs: Tensor, clamp: bool = True) Tensor [source]¶
Apply an IIR filter forward and backward to a waveform.
Inspired by https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html
- Parameters:
waveform (Tensor) – audio waveform of dimension of (…, time). Must be normalized to -1 to 1.
a_coeffs (Tensor) – denominator coefficients of difference equation of dimension of either 1D with shape (num_order + 1) or 2D with shape (num_filters, num_order + 1). Lower delay coefficients are first, e.g.
[a0, a1, a2, ...]
. Must be same size as b_coeffs (pad with 0’s as necessary).b_coeffs (Tensor) – numerator coefficients of difference equation of dimension of either 1D with shape (num_order + 1) or 2D with shape (num_filters, num_order + 1). Lower delay coefficients are first, e.g.
[b0, b1, b2, ...]
. Must be same size as a_coeffs (pad with 0’s as necessary).clamp (bool, optional) – If
True
, clamp the output signal to be in the range [-1, 1] (Default:True
)
- Returns:
Waveform with dimension of either (…, num_filters, time) if
a_coeffs
andb_coeffs
are 2D Tensors, or (…, time) otherwise.- Return type:
Tensor