简体   繁体   English

将窗口函数应用于librosa中的框架

[英]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. 我目前正在ASR系统上工作,但是我忘记将窗口函数应用于每个帧。 I am extracting, which could be the cause to why I am receiving bad results. 我正在提取,这可能是导致我收到不良结果的原因。 But is that possible in librosa ? 但是在librosa可能吗?

I can't find this option in librosa documentation. 我在librosa文档中找不到此选项。

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: Librosa使用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. 在这里,您可以了解librosa内部的操作方式。

But why not to use librosa.stft or librosa.mfcc ? 但是,为什么不使用librosa.stftlibrosa.mfcc It will do everything you need. 它将完成您需要的一切。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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