librosax.amplitude_to_db

amplitude_to_db(S: Array, *, ref: float | Callable = 1.0, amin: float = 1e-05, top_db: float | None = 80.0) floating[Any] | Array[source]

Convert an amplitude spectrogram to decibel (dB) units.

This is equivalent to power_to_db(S**2, ref=ref**2, amin=amin**2, top_db=top_db), but is provided for convenience.

Parameters:
  • S – Input amplitude spectrogram.

  • ref – Reference value for scaling. If scalar, the amplitude abs(S) is scaled relative to ref: 20 * log10(S / ref). If callable, the reference value is computed as ref(S). Default is 1.0.

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

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

Returns:

dB-scaled spectrogram.

Return type:

jnp.ndarray

See also

power_to_db, db_to_amplitude