mirror of https://github.com/coqui-ai/TTS.git
Merge branch 'dev' into PyTorch2.1
This commit is contained in:
commit
96174f2148
|
@ -68,12 +68,9 @@ def wav_to_mel_cloning(
|
||||||
|
|
||||||
def load_audio(audiopath, sampling_rate):
|
def load_audio(audiopath, sampling_rate):
|
||||||
# better load setting following: https://github.com/faroit/python_audio_loading_benchmark
|
# 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
|
# torchaudio should chose proper backend to load audio depending on platform
|
||||||
audio, lsr = torchaudio.load(audiopath, backend="sox")
|
audio, lsr = torchaudio.load(audiopath)
|
||||||
else:
|
|
||||||
# it uses torchaudio soundfile backend to load all the others data type
|
|
||||||
audio, lsr = torchaudio.load(audiopath, backend="soundfile")
|
|
||||||
|
|
||||||
# stereo to mono if needed
|
# stereo to mono if needed
|
||||||
if audio.size(0) != 1:
|
if audio.size(0) != 1:
|
||||||
|
|
Loading…
Reference in New Issue