das.kapre.backend_keras

das.kapre.backend_keras.amplitude_to_decibel(x, amin: float = 1e-10, dynamic_range: float = 80.0)[source]

Convert (linear) amplitude to decibel (log10(x)).

>>> x[x<amin] = amin  # clip everythin below amin
>>> y = 10 * log(x) / log(10)  # log transform
>>> y = ...  # rescale dyn range to [-80, 0]
Parameters
  • x (Tensor) – Tensor

  • amin (float, optional) – Minimal amplitude. Smaller values are clipped to this. Defaults to 1e-10 (dB).

  • dynamic_range (float, optional) – Dynamic range. Defaults to 80.0 (dB).

Returns

Tensor with the values converted to dB

Return type

[Tensor]