Open XEROxMEXICANO opened 1 year ago
I can't get this working, any suggestions?
your wavs aren't mono
To address this issue in my situation, I resolved it by modifying the code within the 'create_mels' function to the following: import librosa import glob
def create_mels(): print("Generating Mels")
def save_mel_librosa(filename):
# Load audio file
audio, sampling_rate = librosa.load(filename, sr=None)
# Compute mel spectrogram
melspec = librosa.feature.melspectrogram(y=audio, sr=sampling_rate, n_mels=128)
# Convert to decibels (log scale)
melspec_db = librosa.power_to_db(melspec, ref=np.max)
# Save mel spectrogram as NumPy file
output_filename = filename.replace('.wav', '')
np.save(output_filename, melspec_db)
wavs = glob.glob('wavs/*.wav')
for i in tqdm(wavs):
save_mel_librosa(i)
I hope that be helpful for you.