From 491f5eea0eebecf390ee932040de9c3f971512c2 Mon Sep 17 00:00:00 2001 From: gorkemgoknar Date: Thu, 9 Nov 2023 15:48:04 +0300 Subject: [PATCH] torchaudio should use proper backend to load audio --- TTS/tts/models/xtts.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/TTS/tts/models/xtts.py b/TTS/tts/models/xtts.py index 7cc9836a..656a80bc 100644 --- a/TTS/tts/models/xtts.py +++ b/TTS/tts/models/xtts.py @@ -69,12 +69,9 @@ def wav_to_mel_cloning( def load_audio(audiopath, sampling_rate): # better load setting following: https://github.com/faroit/python_audio_loading_benchmark - if audiopath[-4:] == ".mp3": - # it uses torchaudio with sox backend to load mp3 - audio, lsr = torchaudio.backend.sox_io_backend.load(audiopath) - else: - # it uses torchaudio soundfile backend to load all the others data type - audio, lsr = torchaudio.backend.soundfile_backend.load(audiopath) + + # torchaudio should chose proper backend to load audio depending on platform + audio, lsr = torchaudio.load(audiopath) # stereo to mono if needed if audio.size(0) != 1: