简体   繁体   中英

Applying a window function to a frame in librosa

I am currently working on an ASR system, and I've forgotten to apply a window function to each frame. I am extracting, which could be the cause to why I am receiving bad results. But is that possible in librosa ?

I can't find this option in librosa documentation.

I need to apply a hamming window on to each frame, which are extracted as such.

   for fp in file_paths:
        y,sr = librosa.load(fp,sr=16000)
        X = librosa.util.frame(y, frame_length=400, hop_length=160)

Librosa employs scipy.signal:

window = scipy.signal.hann(win_length, sym=False)

# Reshape so that the window can be broadcast
window = window.reshape((-1, 1))

windowed = fft_window * X

Here you can see how it is done inside librosa.

But why not to use librosa.stft or librosa.mfcc ? It will do everything you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM