From 66a1e248d03f2cd3cc2ae27b46ebcc9add91a223 Mon Sep 17 00:00:00 2001 From: Gorkem Date: Thu, 9 Nov 2023 18:28:39 +0300 Subject: [PATCH] torchaudio should use proper backend to load audio (#3179) --- 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: