When you are using librosa to process wav file, you may get this error: AttributeError: module ‘librosa.feature’ has no attribute ‘rmse’. In this tutorial, we will introduce you how to fix.
Look at this example code:
if audio.size < frame_length: frame_length = audio.size energy = librosa.feature.rmse(audio, frame_length=frame_length)
Run this code, you will see:
How to fix this AttributeError?
We can use librosa.feature.rms() function. This function is defined as:
librosa.feature.rms(*, y=None, S=None, frame_length=2048, hop_length=512, center=True, pad_mode='constant')
It will compute root-mean-square (RMS) value for each frame.
if audio.size < frame_length: frame_length = audio.size energy = librosa.feature.rms(audio, frame_length=frame_length)
Then, you will find this error is fixed.