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

Added example for MFCC transform (#2637)

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

Note: Python formatter package `black` uses double quotes for the string dict keys (e.g. in `melkwargs` for this example). Please let me know if there is a different linter/format/convention that is preferred!

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

Reviewed By: carolineechen

Differential Revision: D38873729

Pulled By: nateanl

fbshipit-source-id: 2e8fe2930671e7c5d02c0c37cf1ca5cc8c5079e3
parent 789adf07
...@@ -667,6 +667,15 @@ class MFCC(torch.nn.Module): ...@@ -667,6 +667,15 @@ class MFCC(torch.nn.Module):
log_mels (bool, optional): whether to use log-mel spectrograms instead of db-scaled. (Default: ``False``) log_mels (bool, optional): whether to use log-mel spectrograms instead of db-scaled. (Default: ``False``)
melkwargs (dict or None, optional): arguments for MelSpectrogram. (Default: ``None``) melkwargs (dict or None, optional): arguments for MelSpectrogram. (Default: ``None``)
Example
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True)
>>> transform = transforms.MFCC(
>>> sample_rate=sample_rate,
>>> n_mfcc=13,
>>> melkwargs={"n_fft": 400, "hop_length": 160, "n_mels": 23, "center": False},
>>> )
>>> mfcc = transform(waveform)
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