From e23e6f6696eb0728bd4f70000e4fa3609aca8283 Mon Sep 17 00:00:00 2001 From: James Betker Date: Tue, 3 May 2022 20:44:31 -0600 Subject: [PATCH] Use librosa for loading mp3s --- tortoise/utils/audio.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tortoise/utils/audio.py b/tortoise/utils/audio.py index d857da9..e402910 100644 --- a/tortoise/utils/audio.py +++ b/tortoise/utils/audio.py @@ -1,6 +1,7 @@ import os from glob import glob +import librosa import torch import torchaudio import numpy as np @@ -26,9 +27,7 @@ def load_audio(audiopath, sampling_rate): if audiopath[-4:] == '.wav': audio, lsr = load_wav_to_torch(audiopath) elif audiopath[-4:] == '.mp3': - # https://github.com/neonbjb/pyfastmp3decoder - Definitely worth it. - from pyfastmp3decoder.mp3decoder import load_mp3 - audio, lsr = load_mp3(audiopath, sampling_rate) + audio, lsr = librosa.load(audiopath, sr=sampling_rate) audio = torch.FloatTensor(audio) # Remove any channel data.