power_to_db

paddle.audio.functional. power_to_db ( spect: Union[paddle.Tensor, paddle.base.framework.Variable, paddle.base.libpaddle.pir.Value], ref_value: float = 1.0, amin: float = 1e-10, top_db: Optional[float] = 80.0 ) Union[paddle.Tensor, paddle.base.framework.Variable, paddle.base.libpaddle.pir.Value] [source]

Convert a power spectrogram (amplitude squared) to decibel (dB) units. The function computes the scaling 10 * log10(x / ref) in a numerically stable way.

Parameters
  • spect (Tensor) – STFT power spectrogram.

  • ref_value (float, optional) – The reference value. If smaller than 1.0, the db level of the signal will be pulled up accordingly. Otherwise, the db level is pushed down. Defaults to 1.0.

  • amin (float, optional) – Minimum threshold. Defaults to 1e-10.

  • top_db (Optional[float], optional) – Threshold the output at top_db below the peak. Defaults to None.

Returns

Power spectrogram in db scale.

Return type

Tensor

Examples

>>> import paddle

>>> val = 3.0
>>> decibel_paddle = paddle.audio.functional.power_to_db(
...     paddle.to_tensor(val))