mindspore.dataset.audio.transforms.AmplitudeToDB

class mindspore.dataset.audio.transforms.AmplitudeToDB(stype=ScaleType.POWER, ref_value=1.0, amin=1e-10, top_db=80.0)[source]

Converts the input tensor from amplitude/power scale to decibel scale.

Parameters
  • stype (ScaleType, optional) – Scale of the input tensor (default=ScaleType.POWER). It can be one of ScaleType.MAGNITUDE or ScaleType.POWER.

  • ref_value (float, optional) – Param for generate db_multiplier (default=1.0).

  • amin (float, optional) – Lower bound to clamp the input waveform. It must be greater than zero (default=1e-10).

  • top_db (float, optional) – Minimum cut-off decibels. The range of values is non-negative. Commonly set at 80 (default=80.0).

Examples

>>> import numpy as np
>>> from mindspore.dataset.audio import ScaleType
>>>
>>> waveform = np.random.random([1, 400 // 2 + 1, 30])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.AmplitudeToDB(stype=ScaleType.POWER)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])