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

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

我想使用 librosa 从音频中提取短时能量,但我得到了

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

我需要这个问题的解决方案。 我的代码:

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)

那是因为librosa没有这个功能。您可能想将其替换为例如RMS 计算每一帧的均方根 (RMS) 值 - 本质上是能量。

fn_list_i = [
    feature.rms
]