mindspore.dataset.audio.Flanger

class mindspore.dataset.audio.Flanger(sample_rate, delay=0.0, depth=2.0, regen=0.0, width=71.0, speed=0.5, phase=25.0, modulation=Modulation.SINUSOIDAL, interpolation=Interpolation.LINEAR)[source]

Apply a flanger effect to the audio.

Similar to SoX implementation.

Parameters
  • sample_rate (int) – Sampling rate of the waveform, e.g. 44100 (Hz).

  • delay (float, optional) – Desired delay in milliseconds, in range of [0, 30]. Default: 0.0.

  • depth (float, optional) – Desired delay depth in milliseconds, in range of [0, 10]. Default: 2.0.

  • regen (float, optional) – Desired regen (feedback gain) in dB, in range of [-95, 95]. Default: 0.0.

  • width (float, optional) – Desired width (delay gain) in dB, in range of [0, 100]. Default: 71.0.

  • speed (float, optional) – Modulation speed in Hz, in range of [0.1, 10]. Default: 0.5.

  • phase (float, optional) – Percentage phase-shift for multi-channel, in range of [0, 100]. Default: 25.0.

  • modulation (Modulation, optional) – Modulation method, can be Modulation.SINUSOIDAL or Modulation.TRIANGULAR. Default: Modulation.SINUSOIDAL.

  • interpolation (Interpolation, optional) – Interpolation method, can be Interpolation.LINEAR or Interpolation.QUADRATIC. Default: Interpolation.LINEAR.

Raises
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.Flanger(44100)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
Tutorial Examples: