-
Notifications
You must be signed in to change notification settings - Fork 730
Add autograd test for T.MelScale #1467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cc @mthrok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work. Please refer to my comments.
def test_melscale(self): | ||
sample_rate = 8000 | ||
transform = T.MelScale(sample_rate=sample_rate) | ||
waveform = get_whitenoise(sample_rate=sample_rate, duration=0.05, n_channels=2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input to MelScale
has to be spectrogram. Passing waveform here, the MelScale
will work on a wrong dimension, so we need to generate spectrogram from waveform and set the proper parameters.
Something like this.
n_fft = 400
n_mels = n_fft // 2 + 1
transform = T.MelScale(sample_rate=sample_rate, n_mels=n_mels)
spec = get_spectrogram(
get_whitenoise(sample_rate=8000, duration=0.05, n_channels=2),
n_fft=n_fft, power=1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. To be honest I was not sure about this one.
n_fft = 400 | ||
n_mels = n_fft // 2 + 1 | ||
transform = T.MelScale(sample_rate=sample_rate, n_mels=n_mels) | ||
waveform = get_spectrogram( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename waveform
to spectrogram
or spec
?
This might appear trivial, but this is rather important for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
Thanks for the reviews Gentlemen! |
Ref #1414