torchaudio.functional.amplitude_to_DB¶
- torchaudio.functional.amplitude_to_DB(x: Tensor, multiplier: float, amin: float, db_multiplier: float, top_db: Optional[float] = None) Tensor [source]¶
Turn a spectrogram from the power/amplitude scale to the decibel scale.
The output of each tensor in a batch depends on the maximum value of that tensor, and so may return different values for an audio clip split into snippets vs. a full clip.
- Parameters:
x (Tensor) – Input spectrogram(s) before being converted to decibel scale. Input should take the form (…, freq, time). Batched inputs should include a channel dimension and have the form (batch, channel, freq, time).
multiplier (float) – Use 10. for power and 20. for amplitude
amin (float) – Number to clamp
x
db_multiplier (float) – Log10(max(reference value and amin))
top_db (float or None, optional) – Minimum negative cut-off in decibels. A reasonable number is 80. (Default:
None
)
- Returns:
Output tensor in decibel scale
- Return type:
Tensor