Commit 05545791 authored by Ravi Makhija's avatar Ravi Makhija Committed by Facebook GitHub Bot
Browse files

Added example for AmplitudeToDB transform (#2615)

Summary:
Added example for AmplitudeToDB transform as mentioned in issue https://github.com/pytorch/audio/issues/1564.

Pull Request resolved: https://github.com/pytorch/audio/pull/2615

Reviewed By: carolineechen

Differential Revision: D38743117

Pulled By: nateanl

fbshipit-source-id: bf0f760299f4777a4bca65da86359faa00b16207
parent 3742cebb
...@@ -310,6 +310,11 @@ class AmplitudeToDB(torch.nn.Module): ...@@ -310,6 +310,11 @@ class AmplitudeToDB(torch.nn.Module):
power being the elementwise square of the magnitude. (Default: ``'power'``) power being the elementwise square of the magnitude. (Default: ``'power'``)
top_db (float or None, optional): minimum negative cut-off in decibels. A reasonable top_db (float or None, optional): minimum negative cut-off in decibels. A reasonable
number is 80. (Default: ``None``) number is 80. (Default: ``None``)
Example
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True)
>>> transform = transforms.AmplitudeToDB(stype="amplitude", top_db=80)
>>> waveform_db = transform(waveform)
""" """
__constants__ = ["multiplier", "amin", "ref_value", "db_multiplier"] __constants__ = ["multiplier", "amin", "ref_value", "db_multiplier"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment