mindspore.dataset.audio.Vol

class mindspore.dataset.audio.Vol(gain, gain_type=GainType.AMPLITUDE)[source]

Adjust volume of waveform.

Parameters
  • gain (float) – Gain at the boost (or attenuation). If gain_type is GainType.AMPLITUDE, it is a non negative amplitude ratio. If gain_type is GainType.POWER, it is a power (voltage squared). If gain_type is GainType.DB, it is in decibels.

  • gain_type (GainType, optional) – Type of gain, can be GainType.AMPLITUDE, GainType.POWER or GainType.DB. Default: GainType.AMPLITUDE.

Raises
Supported Platforms:

CPU

Examples

>>> import numpy as np
>>> from mindspore.dataset.audio import GainType
>>>
>>> waveform = np.random.random([20, 30])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.Vol(gain=10, gain_type=GainType.DB)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])