"git@developer.sourcefind.cn:OpenDAS/ktransformers.git" did not exist on "a3ba63665a4015e49de0fb884a4178567b64456b"
Commit 3742cebb authored by Ravi Makhija's avatar Ravi Makhija Committed by Facebook GitHub Bot
Browse files

Added example for MelScale transform (#2616)

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

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

Reviewed By: carolineechen

Differential Revision: D38743145

Pulled By: nateanl

fbshipit-source-id: e24ca92f5317a0ea5a141418bf084b12cfb22486
parent 9efefff1
...@@ -355,6 +355,13 @@ class MelScale(torch.nn.Module): ...@@ -355,6 +355,13 @@ class MelScale(torch.nn.Module):
(area normalization). (Default: ``None``) (area normalization). (Default: ``None``)
mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``) mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``)
Example
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True)
>>> spectrogram_transform = transforms.Spectrogram(n_fft=1024)
>>> spectrogram = spectrogram_transform(waveform)
>>> melscale_transform = transforms.MelScale(sample_rate=sample_rate, n_stft=1024 // 2 + 1)
>>> melscale_spectrogram = melscale_transform(spectrogram)
See also: See also:
:py:func:`torchaudio.functional.melscale_fbanks` - The function used to :py:func:`torchaudio.functional.melscale_fbanks` - The function used to
generate the filter banks. generate the filter banks.
......
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