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 one of 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).
Examples
>>> import numpy as np >>> >>> 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"])