mindspore.dataset.audio.Vol
- class mindspore.dataset.audio.Vol(gain, gain_type=GainType.AMPLITUDE)[source]
Apply amplification or attenuation to the whole waveform.
- Parameters
gain (float) – Value of gain adjustment. If gain_type = amplitude, gain stands for nonnegative amplitude ratio. If gain_type = power, gain stands for power. If gain_type = db, gain stands for decibels.
gain_type (GainType, optional) – Type of gain, contains the following three enumeration values GainType.AMPLITUDE, GainType.POWER and GainType.DB (default=GainType.AMPLITUDE).
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"])