mindspore.dataset.audio.TrebleBiquad

class mindspore.dataset.audio.TrebleBiquad(sample_rate, gain, central_freq=3000, Q=0.707)[source]

Design a treble tone-control effect.

Similar to SoX implementation.

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

  • gain (float) – Desired gain at the boost (or attenuation) in dB.

  • central_freq (float, optional) – Central frequency (in Hz). Default: 3000.

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

Raises
Supported Platforms:

CPU

Examples

>>> import numpy as np
>>> import mindspore.dataset as ds
>>> import mindspore.dataset.audio as audio
>>>
>>> # Use the transform in dataset pipeline mode
>>> waveform = np.random.random([5, 20])  # 5 samples
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.TrebleBiquad(44100, 200.0)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
>>> for item in numpy_slices_dataset.create_dict_iterator(num_epochs=1, output_numpy=True):
...     print(item["audio"].shape, item["audio"].dtype)
...     break
(20,) float64
>>>
>>> # Use the transform in eager mode
>>> waveform = np.random.random([20])  # 1 sample
>>> output = audio.TrebleBiquad(44100, 200.0)(waveform)
>>> print(output.shape, output.dtype)
(20,) float64
Tutorial Examples: