mindspore.dataset.audio.DCShift
- class mindspore.dataset.audio.DCShift(shift, limiter_gain=None)[source]
Apply a DC shift to the audio. This can be useful to remove DC offset from audio.
- Parameters
- Raises
TypeError – If shift is not of type float.
ValueError – If shift is not in range [-2.0, 2.0].
TypeError – If limiter_gain is not of type float.
- Supported Platforms:
CPU
Examples
>>> import numpy as np >>> import mindspore.dataset as ds >>> import mindspore.dataset.audio as audio >>> >>> waveform = np.array([0.60, 0.97, -1.04, -1.26, 0.97, 0.91, 0.48, 0.93]) >>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"]) >>> transforms = [audio.DCShift(0.5, 0.02)] >>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
- Tutorial Examples: