Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/torchaudio_unittest/sox_io_backend/save_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_multiple_channels(self, dtype, num_channels):
@parameterized.expand(list(itertools.product(
[8000, 16000],
[1, 2],
[-4.2, -0.2, 0, 0.2, 96, 128, 160, 192, 224, 256, 320],
[None, -4.2, -0.2, 0, 0.2, 96, 128, 160, 192, 224, 256, 320],
)), name_func=name_func)
def test_mp3(self, sample_rate, num_channels, bit_rate):
"""`sox_io_backend.save` can save mp3 format."""
Expand All @@ -254,7 +254,7 @@ def test_mp3_large(self, sample_rate, num_channels, bit_rate):
@parameterized.expand(list(itertools.product(
[8000, 16000],
[1, 2],
list(range(9)),
[None] + list(range(9)),
)), name_func=name_func)
def test_flac(self, sample_rate, num_channels, compression_level):
"""`sox_io_backend.save` can save flac format."""
Expand All @@ -273,7 +273,7 @@ def test_flac_large(self, sample_rate, num_channels, compression_level):
@parameterized.expand(list(itertools.product(
[8000, 16000],
[1, 2],
[-1, 0, 1, 2, 3, 3.6, 5, 10],
[None, -1, 0, 1, 2, 3, 3.6, 5, 10],
)), name_func=name_func)
def test_vorbis(self, sample_rate, num_channels, quality_level):
"""`sox_io_backend.save` can save vorbis format."""
Expand Down
2 changes: 1 addition & 1 deletion torchaudio/backend/sox_io_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def save(
See the detail at http://sox.sourceforge.net/soxformat.html.
"""
if compression is None:
ext = str(filepath)[-3:].lower()
ext = str(filepath).split('.')[-1].lower()
if ext in ['wav', 'sph']:
compression = 0.
elif ext == 'mp3':
Expand Down