Commit 709b4439 authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Update and fix tutorials (#2701)

Summary:
* Fix Sphinx warning
* Update asset management

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

Reviewed By: carolineechen

Differential Revision: D39714126

Pulled By: mthrok

fbshipit-source-id: a5b04cfbf8bedce67c621b6bfe1dcd975b343313
parent ad2b61d7
...@@ -437,7 +437,7 @@ Audio(filtered, rate=sample_rate2) ...@@ -437,7 +437,7 @@ Audio(filtered, rate=sample_rate2)
###################################################################### ######################################################################
# Codec applied: # Codec applied:
# ~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~
# #
Audio(codec_applied, rate=sample_rate2) Audio(codec_applied, rate=sample_rate2)
...@@ -31,32 +31,11 @@ print(torchaudio.__version__) ...@@ -31,32 +31,11 @@ print(torchaudio.__version__)
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# Preparation of data and helper functions. # Preparation of data and helper functions.
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
import os
import librosa import librosa
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import requests from torchaudio.utils import download_asset
_SAMPLE_DIR = "_assets"
SAMPLE_WAV_SPEECH_URL = "https://pytorch-tutorial-assets.s3.amazonaws.com/VOiCES_devkit/source-16k/train/sp0307/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav" # noqa: E501
SAMPLE_WAV_SPEECH_PATH = os.path.join(_SAMPLE_DIR, "speech.wav")
os.makedirs(_SAMPLE_DIR, exist_ok=True)
def _fetch_data():
uri = [
(SAMPLE_WAV_SPEECH_URL, SAMPLE_WAV_SPEECH_PATH),
]
for url, path in uri:
with open(path, "wb") as file_:
file_.write(requests.get(url).content)
_fetch_data() SAMPLE_WAV_SPEECH_PATH = download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
def _get_sample(path, resample=None): def _get_sample(path, resample=None):
......
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