I am trying to sample (convert analog to digital) mp3 files via the following Python code using the librosa
library, but it takes too much time (around 4 seconds for one file). I suspect this is because librosa
doesn't support mp3
and hence uses the slower audioread
to sample mp3
Code:
import time
import librosa
s = time.time()
for i in mp3_list[:10]: # list of mp3 file paths, doing for 10 files
y, sr = librosa.load(i)
print('time taken =', time.time() - s)
time taken = 36.55561399459839
I also get this warning:
UserWarning: "PySoundFile failed. Trying audioread instead."
Obviously, this is too much time for any practical application. I want to know if there are better alternatives to this?
For comparison, it only took around 1.2
seconds total time to sample 10 same-sized wav
conversions