mindspore.dataset.audio.HighpassBiquad

class mindspore.dataset.audio.HighpassBiquad(sample_rate, cutoff_freq, Q=0.707)[source]

Design biquad highpass filter and perform filtering.

Similar to SoX implementation.

Parameters
  • sample_rate (int) – Sampling rate of the waveform, e.g. 44100 (Hz), the value can’t be 0.

  • cutoff_freq (float) – Filter cutoff frequency (in Hz).

  • Q (float, optional) – Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707.

Raises
  • TypeError – If sample_rate is not of type int.

  • ValueError – If sample_rate is 0.

  • TypeError – If cutoff_freq is not of type float.

  • TypeError – If Q is not of type float.

  • ValueError – If Q is not in range of (0, 1].

  • RuntimeError – If the shape of input audio waveform does not match <…, 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]])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.HighpassBiquad(44100, 1500, 0.7)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
Tutorial Examples: