mindspore.dataset.audio.Dither

class mindspore.dataset.audio.Dither(density_function=DensityFunction.TPDF, noise_shaping=False)[source]

Dither increases the perceived dynamic range of audio stored at a particular bit-depth by eliminating nonlinear truncation distortion.

Parameters
  • density_function (DensityFunction, optional) – The density function of a continuous random variable, can be DensityFunction.TPDF (Triangular Probability Density Function), DensityFunction.RPDF (Rectangular Probability Density Function) or DensityFunction.GPDF (Gaussian Probability Density Function). Default: DensityFunction.TPDF.

  • noise_shaping (bool, optional) – A filtering process that shapes the spectral energy of quantisation error. Default: False.

Raises
Supported Platforms:

CPU

Examples

>>> import numpy as np
>>> import mindspore.dataset as ds
>>> import mindspore.dataset.audio as audio
>>>
>>> waveform = np.array([[1, 2, 3], [4, 5, 6]])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.Dither()]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
Tutorial Examples: