From 38e9e34929b29521b346c652eed2503cd787427a Mon Sep 17 00:00:00 2001 From: JuHyuk Park Date: Wed, 11 Mar 2020 14:34:18 +0900 Subject: [PATCH 1/3] Typo in beginner_source/audio_preprocessing_tutorial.py Typo in beginner_source/audio_preprocessing_tutorial.py fron > from --- beginner_source/audio_preprocessing_tutorial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beginner_source/audio_preprocessing_tutorial.py b/beginner_source/audio_preprocessing_tutorial.py index 01c5a4a748a..bf3930408e3 100644 --- a/beginner_source/audio_preprocessing_tutorial.py +++ b/beginner_source/audio_preprocessing_tutorial.py @@ -207,7 +207,7 @@ def normalize(tensor): plt.plot(mu_law_encoding_waveform[0,:].numpy()) ###################################################################### -# You can see how the output fron ``torchaudio.functional.mu_law_encoding`` is the same as +# You can see how the output from ``torchaudio.functional.mu_law_encoding`` is the same as # the output from ``torchaudio.transforms.MuLawEncoding``. # # Now let's experiment with a few of the other functionals and visualize their output. Taking our From c2877f3dd21dab24344ec6789ae8386ae16cf7cb Mon Sep 17 00:00:00 2001 From: Vincent Quenneville-Belair Date: Thu, 22 Oct 2020 16:56:52 -0400 Subject: [PATCH 2/3] update title. --- beginner_source/audio_preprocessing_tutorial.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/beginner_source/audio_preprocessing_tutorial.py b/beginner_source/audio_preprocessing_tutorial.py index bf3930408e3..773fdbb327f 100644 --- a/beginner_source/audio_preprocessing_tutorial.py +++ b/beginner_source/audio_preprocessing_tutorial.py @@ -1,6 +1,6 @@ """ -torchaudio Tutorial -=================== +Audio I/O and Pre-Processing with torchaudio +============================================ PyTorch is an open source deep learning platform that provides a seamless path from research prototyping to production deployment with @@ -10,7 +10,8 @@ preparation. ``torchaudio`` leverages PyTorch’s GPU support, and provides many tools to make data loading easy and more readable. In this tutorial, we will see how to load and preprocess data from a simple -dataset. +dataset. Please visit +`Audio I/O and Pre-Processing with torchaudio `__ to learn more. For this tutorial, please make sure the ``matplotlib`` package is installed for easier visualization. From 70e0c9d239a73ab725a1e8b441a8c0a0c6d03ca4 Mon Sep 17 00:00:00 2001 From: Vincent Quenneville-Belair Date: Thu, 22 Oct 2020 16:57:20 -0400 Subject: [PATCH 3/3] fix file access. --- beginner_source/audio_preprocessing_tutorial.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/beginner_source/audio_preprocessing_tutorial.py b/beginner_source/audio_preprocessing_tutorial.py index 773fdbb327f..309ba9d3db2 100644 --- a/beginner_source/audio_preprocessing_tutorial.py +++ b/beginner_source/audio_preprocessing_tutorial.py @@ -20,6 +20,7 @@ import torch import torchaudio +import requests import matplotlib.pyplot as plt ###################################################################### @@ -30,7 +31,13 @@ # call waveform the resulting raw audio signal. # -filename = "../_static/img/steam-train-whistle-daniel_simon-converted-from-mp3.wav" +url = "https://pytorch.org/tutorials/_static/img/steam-train-whistle-daniel_simon-converted-from-mp3.wav" +r = requests.get(url) + +with open('steam-train-whistle-daniel_simon-converted-from-mp3.wav', 'wb') as f: + f.write(r.content) + +filename = "steam-train-whistle-daniel_simon-converted-from-mp3.wav" waveform, sample_rate = torchaudio.load(filename) print("Shape of waveform: {}".format(waveform.size()))