mindspore.dataset.audio.BandBiquad

class mindspore.dataset.audio.BandBiquad(sample_rate, central_freq, Q=0.707, noise=False)[source]

Design two-pole band-pass filter for audio waveform.

The frequency response drops logarithmically around the center frequency. The bandwidth gives the slope of the drop. The frequencies at band edge will be half of their original amplitudes.

Similar to SoX implementation.

Note

The shape of the audio waveform to be processed needs to be <…, time>.

Parameters
  • sample_rate (int) – Sampling rate (in Hz), which can’t be zero.

  • central_freq (float) – Central frequency (in Hz).

  • Q (float, optional) – Quality factor , in range of (0, 1]. Default: 0.707.

  • noise (bool, optional) – If True, uses the alternate mode for un-pitched audio (e.g. percussion). If False, uses mode oriented to pitched audio, i.e. voice, singing, or instrumental music. Default: False.

Raises
Supported Platforms:

CPU

Examples

>>> import numpy as np
>>>
>>> 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.BandBiquad(44100, 200.0)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])