mindspore.dataset.audio.Phaser

class mindspore.dataset.audio.Phaser(sample_rate, gain_in=0.4, gain_out=0.74, delay_ms=3.0, decay=0.4, mod_speed=0.5, sinusoidal=True)[源代码]

Apply a phasing effect to the audio.

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

  • gain_in (float) – Desired input gain at the boost (or attenuation) in dB. Allowed range of values is [0, 1] (default=0.4).

  • gain_out (float) – Desired output gain at the boost (or attenuation) in dB. Allowed range of values is [0, 1e9] (default=0.74).

  • delay_ms (float) – Desired delay in milli seconds. Allowed range of values is [0, 5] (default=3.0).

  • decay (float) – Desired decay relative to gain-in. Allowed range of values is [0, 0.99] (default=0.4).

  • mod_speed (float) – Modulation speed in Hz. Allowed range of values is [0.1, 2] (default=0.5).

  • sinusoidal (bool) – If True, use sinusoidal modulation (preferable for multiple instruments). If False, use triangular modulation (gives single instruments a sharper phasing effect) (default=True).

Examples

>>> import numpy as np
>>>
>>> waveform = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32)
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.Phaser(44100)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])