diff --git a/test/torchaudio_unittest/datasets/quesst14_test.py b/test/torchaudio_unittest/datasets/quesst14_test.py index a69a9c3022..54604a03c8 100644 --- a/test/torchaudio_unittest/datasets/quesst14_test.py +++ b/test/torchaudio_unittest/datasets/quesst14_test.py @@ -4,7 +4,6 @@ from parameterized import parameterized from torchaudio.datasets import quesst14 -from torchaudio.sox_effects import apply_effects_tensor from torchaudio_unittest.common_utils import ( TempDirMixin, TorchaudioTestCase, @@ -39,18 +38,14 @@ def _save_sample(dataset_dir, folder, language, index, sample_rate, seed): filename = _get_filename(folder, index) file_path = os.path.join(path, filename) - raw_data = get_whitenoise( + data = get_whitenoise( sample_rate=sample_rate, duration=0.01, n_channels=1, seed=seed, ) - save_wav(file_path, raw_data, sample_rate) + save_wav(file_path, data, sample_rate) - data, _ = apply_effects_tensor( - raw_data, - sample_rate=sample_rate, - ) sample = (data.squeeze(0), Path(file_path).with_suffix("").name) # add audio files and language data to language key files @@ -90,7 +85,7 @@ def get_mock_dataset(dataset_dir): dataset_dir: directory to the mocked dataset """ os.makedirs(dataset_dir, exist_ok=True) - sample_rate = 16000 + sample_rate = 8000 audio_seed = 0 dev_seed = 1 @@ -114,6 +109,8 @@ def get_mock_dataset(dataset_dir): class TestQuesst14(TempDirMixin, TorchaudioTestCase): root_dir = None + backend = "default" + utterances = {} dev_samples = {} eval_samples = {} diff --git a/torchaudio/datasets/quesst14.py b/torchaudio/datasets/quesst14.py index 32f5441c15..88f0a8c9de 100644 --- a/torchaudio/datasets/quesst14.py +++ b/torchaudio/datasets/quesst14.py @@ -4,10 +4,10 @@ from typing import Tuple, Union, Optional import torch +import torchaudio from torch.hub import download_url_to_file from torch.utils.data import Dataset from torchaudio.datasets.utils import extract_archive -from torchaudio.sox_effects import apply_effects_file URL = "https://speech.fit.vutbr.cz/files/quesst14Database.tgz" @@ -78,13 +78,7 @@ def __init__( def _load_sample(self, n: int) -> Tuple[torch.Tensor, str]: audio_path = self.data[n] - wav, _ = apply_effects_file( - str(audio_path), - [ - ["channels", "1"], - ["rate", "16000"], - ], - ) + wav, _ = torchaudio.load(audio_path) wav = wav.squeeze(0) return wav, audio_path.with_suffix("").name