librosax.power_to_db

power_to_db(x: Array, amin: float = 1e-10, top_db: float | None = 80.0, ref: float = 1.0) Array[source]

Convert a power spectrogram to decibel (dB) units.

Parameters:
  • x – Input power spectrogram.

  • amin – Minimum threshold for input values. Default is 1e-10.

  • top_db – Threshold the output at top_db below the peak. Default is 80.0.

  • ref – Reference value for scaling. Default is 1.0.

Returns:

dB-scaled spectrogram.

Return type:

jnp.ndarray

Raises:

librosax.util.exceptions.ParameterError – If top_db is negative.