mindspore.dataset.audio.LFilter
- class mindspore.dataset.audio.LFilter(a_coeffs, b_coeffs, clamp=True)[source]
Perform an IIR filter by evaluating different equation.
- Parameters
a_coeffs (Sequence[float]) – Denominator coefficients of difference equation of dimension. Lower delays coefficients are first, e.g. [a0, a1, a2, …]. Must be same size as b_coeffs (pad with 0’s as necessary).
b_coeffs (Sequence[float]) – Numerator coefficients of difference equation of dimension. Lower delays 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
.
- Raises
TypeError – If a_coeffs is not of type Sequence[float].
TypeError – If b_coeffs is not of type Sequence[float].
ValueError – If a_coeffs and b_coeffs are of different sizes.
TypeError – If clamp is not of type bool.
RuntimeError – If input tensor is not in shape of <…, time>.
- Supported Platforms:
CPU
Examples
>>> import numpy as np >>> import mindspore.dataset as ds >>> import mindspore.dataset.audio as audio >>> >>> waveform = np.array([[2.716064453125e-03, 6.34765625e-03], [9.246826171875e-03, 1.0894775390625e-02]]) >>> a_coeffs = [0.1, 0.2, 0.3] >>> b_coeffs = [0.1, 0.2, 0.3] >>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"]) >>> transforms = [audio.LFilter(a_coeffs, b_coeffs)] >>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
- Tutorial Examples: