1

I want to extract short time energy from audio by using librosa, but I get

AttributeError: module 'librosa.feature' has no attribute 'short_time_energy'.

I need a solution for this problem. My code:

fn_list_i = [
    feature.short_time_energy
]
    
def calculateSTE(audio_signal, window_type, frame_length, hop_size):
    signal_new = []                           # container for signal square
    win = Windowing(type = window_type)       # instantiate window function
    
    # compute signal square by frame
    for frame in FrameGenerator(audio_signal, frameSize=frame_length, hopSize=hop_size, startFromZero=True):
        frame_new = frame**2
        signal_new.append(frame_new)
    
    # output the convolution of window and signal square
    return np.convolve(signal_new, win)
azro
  • 53,056
  • 7
  • 34
  • 70
sera
  • 63
  • 5

1 Answers1

0

That's because librosa does not have such a function. You might want to replace it with e.g. RMS which computes root-mean-square (RMS) value for each frame - essentially the energy.

fn_list_i = [
    feature.rms
]
Lukasz Tracewski
  • 10,794
  • 3
  • 34
  • 53