Skip to content
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

mistake in torchaudio data augmentation tutorial #1930

Closed
Moadab-AI opened this issue May 26, 2022 · 3 comments
Closed

mistake in torchaudio data augmentation tutorial #1930

Moadab-AI opened this issue May 26, 2022 · 3 comments
Assignees
Labels
torchaudio Issues relating to torchaudio tutorials triaged Issues has been triaged

Comments

@Moadab-AI
Copy link

Moadab-AI commented May 26, 2022

In the "adding background noise" section of the tutorial file :
https://github.com/pytorch/tutorials/blob/master/beginner_source/audio_data_augmentation_tutorial.py

first of all you are calculating RMS but calling it power:

speech_power = speech.norm(p=2)
noise_power = noise.norm(p=2)

and then since you're dealing with RMS, the snr_db should be divided by 20 and not 10:
snr = math.exp(snr_db / 10)

also for a "standard" SNr value you'd have to use to log in base 10 as well i suppose.

@svekars
Copy link
Contributor

svekars commented Jul 29, 2022

@mthrok can you take a look?

@mthrok
Copy link
Contributor

mthrok commented Jul 29, 2022

Hi @Moadab-AI

Thanks for the issue. I think this has been fixed in torchaudio side pytorch/audio#2285, and the change was ported in tutorial site #1939, which happened in June.

Can you confirm that https://pytorch.org/tutorials/beginner/audio_data_augmentation_tutorial.html#adding-background-noise looks okay now?

Separately, I just realized that it has not been fixed on the next section; https://pytorch.org/tutorials/beginner/audio_data_augmentation_tutorial.html#simulating-a-phone-recoding

@svekars svekars added triaged Issues has been triaged torchaudio Issues relating to torchaudio tutorials labels Jul 29, 2022
mthrok added a commit to mthrok/audio that referenced this issue Jul 29, 2022
In pytorch#2285, the SNR calculation was fixed,
but there was still one that was not fixed. This commit fixes it.

Also following the feedback pytorch/tutorials#1930 (comment), update the variable name.
mthrok added a commit that referenced this issue Aug 1, 2022
facebook-github-bot pushed a commit to pytorch/audio that referenced this issue Aug 1, 2022
Summary:
In #2285, the SNR calculation was fixed,
but there was still one that was not fixed. This commit fixes it.

Also following the feedback pytorch/tutorials#1930 (comment), update the variable name.

Pull Request resolved: #2595

Reviewed By: carolineechen

Differential Revision: D38314672

Pulled By: mthrok

fbshipit-source-id: b2015e2709729190d97264aa191651b3af4ba856
mthrok added a commit to pytorch/audio that referenced this issue Aug 1, 2022
Summary:
In #2285, the SNR calculation was fixed,
but there was still one that was not fixed. This commit fixes it.

Also following the feedback pytorch/tutorials#1930 (comment), update the variable name.

Pull Request resolved: #2595

Reviewed By: carolineechen

Differential Revision: D38314672

Pulled By: mthrok

fbshipit-source-id: b2015e2709729190d97264aa191651b3af4ba856
@svekars
Copy link
Contributor

svekars commented Mar 3, 2023

This tutorial was moved. If this is still an issue, please raise in the pytorch/audio repo.

@svekars svekars closed this as completed Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
torchaudio Issues relating to torchaudio tutorials triaged Issues has been triaged
Projects
None yet
Development

No branches or pull requests

3 participants