Skip to content

Commit 9c54cd7

Browse files
committed
Removed torchaudio_unittest module from loudness test
1 parent b173b58 commit 9c54cd7

File tree

5 files changed

+46
-60
lines changed

5 files changed

+46
-60
lines changed

.github/workflows/integration-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
run: |
3030
python -m pip install --quiet --upgrade pip
3131
python -m pip install --quiet --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
32-
python -m pip install --quiet pytest requests expecttest parameterized scipy cmake ninja deep-phonemizer sentencepiece
32+
python -m pip install --quiet pytest requests cmake ninja deep-phonemizer sentencepiece
3333
python setup.py install
3434
env:
3535
USE_FFMPEG: true

test/integration_tests/loudness_compliance_cpu_test.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

test/integration_tests/loudness_compliance_cuda_test.py

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""Test suite for compliance with the ITU-R BS.1770-4 recommendation"""
2+
import zipfile
3+
4+
import pytest
5+
6+
import torch
7+
import torchaudio
8+
import torchaudio.functional as F
9+
10+
11+
# Test files linked in https://www.itu.int/dms_pub/itu-r/opb/rep/R-REP-BS.2217-2-2016-PDF-E.pdf
12+
@pytest.mark.parametrize(
13+
"filename,url,expected",
14+
[
15+
(
16+
"1770-2_Comp_RelGateTest",
17+
"http://www.itu.int/dms_pub/itu-r/oth/11/02/R11020000010030ZIPM.zip",
18+
-10.0,
19+
),
20+
(
21+
"1770-2_Comp_AbsGateTest",
22+
"http://www.itu.int/dms_pub/itu-r/oth/11/02/R11020000010029ZIPM.zip",
23+
-69.5,
24+
),
25+
(
26+
"1770-2_Comp_24LKFS_500Hz_2ch",
27+
"http://www.itu.int/dms_pub/itu-r/oth/11/02/R11020000010018ZIPM.zip",
28+
-24.0,
29+
),
30+
(
31+
"1770-2 Conf Mono Voice+Music-24LKFS",
32+
"http://www.itu.int/dms_pub/itu-r/oth/11/02/R11020000010038ZIPM.zip",
33+
-24.0,
34+
),
35+
],
36+
)
37+
def test_loudness(tmp_path, filename, url, expected):
38+
zippath = tmp_path / filename
39+
torch.hub.download_url_to_file(url, zippath, progress=False)
40+
with zipfile.ZipFile(zippath) as file:
41+
file.extractall(zippath.parent)
42+
43+
waveform, sample_rate = torchaudio.load(zippath.with_suffix(".wav"))
44+
loudness = F.loudness(waveform, sample_rate)
45+
assert pytest.approx(loudness.item(), rel=0.01, abs=0.1) == expected

test/integration_tests/loudness_compliance_test_impl.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)