Merge pull request #424 from yairl/master

Support both sox and sox_io backends for in-place audio resampling.
This commit is contained in:
Alexander Veysov
2024-02-16 14:08:40 +03:00
committed by GitHub

View File

@@ -122,7 +122,10 @@ class Validator():
def read_audio(path: str,
sampling_rate: int = 16000):
if 'sox_io' in torchaudio.list_audio_backends():
sox_backends = set(['sox', 'sox_io'])
audio_backends = torchaudio.list_audio_backends()
if len(sox_backends.intersection(audio_backends)) > 0:
effects = [
['channels', '1'],
['rate', str(sampling_rate)]