Caution
You're reading the documentation for a development version. For the latest released version, please have a look at 0.9.1.
librosa.amplitude_to_db¶
- librosa.amplitude_to_db(S, *, ref=1.0, amin=1e-05, top_db=80.0)[source]¶
Convert an amplitude spectrogram to dB-scaled spectrogram.
This is equivalent to
power_to_db(S**2), but is provided for convenience.- Parameters
- Snp.ndarray
input amplitude
- refscalar or callable
If scalar, the amplitude
abs(S)is scaled relative toref:20 * log10(S / ref). Zeros in the output correspond to positions whereS == ref.If callable, the reference value is computed as
ref(S).- aminfloat > 0 [scalar]
minimum threshold for
Sandref- top_dbfloat >= 0 [scalar]
threshold the output at
top_dbbelow the peak:max(20 * log10(S)) - top_db
- Returns
- S_dbnp.ndarray
Smeasured in dB
See also
Notes
This function caches at level 30.