mindspore.dataset.audio.Contrast

class mindspore.dataset.audio.Contrast(enhancement_amount=75.0)[source]

Apply contrast effect for audio waveform.

Comparable with compression, this effect modifies an audio signal to make it sound louder.

Similar to SoX implementation.

Note

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

Parameters

enhancement_amount (float, optional) – Controls the amount of the enhancement, in range of [0, 100]. Default: 75.0. Note that enhancement_amount equal to 0 still gives a significant contrast enhancement.

Raises
  • TypeError – If enhancement_amount is not of type float.

  • ValueError – If enhancement_amount is not in range [0, 100].

  • RuntimeError – If input tensor is not in shape of <…, 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.Contrast()]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
Tutorial Examples: