Use librosa for loading mp3s
Browse files- tortoise/utils/audio.py +2 -3
tortoise/utils/audio.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
from glob import glob
|
3 |
|
|
|
4 |
import torch
|
5 |
import torchaudio
|
6 |
import numpy as np
|
@@ -26,9 +27,7 @@ def load_audio(audiopath, sampling_rate):
|
|
26 |
if audiopath[-4:] == '.wav':
|
27 |
audio, lsr = load_wav_to_torch(audiopath)
|
28 |
elif audiopath[-4:] == '.mp3':
|
29 |
-
|
30 |
-
from pyfastmp3decoder.mp3decoder import load_mp3
|
31 |
-
audio, lsr = load_mp3(audiopath, sampling_rate)
|
32 |
audio = torch.FloatTensor(audio)
|
33 |
|
34 |
# Remove any channel data.
|
|
|
1 |
import os
|
2 |
from glob import glob
|
3 |
|
4 |
+
import librosa
|
5 |
import torch
|
6 |
import torchaudio
|
7 |
import numpy as np
|
|
|
27 |
if audiopath[-4:] == '.wav':
|
28 |
audio, lsr = load_wav_to_torch(audiopath)
|
29 |
elif audiopath[-4:] == '.mp3':
|
30 |
+
audio, lsr = librosa.load(audiopath, sr=sampling_rate)
|
|
|
|
|
31 |
audio = torch.FloatTensor(audio)
|
32 |
|
33 |
# Remove any channel data.
|