gpt4 book ai didi

java - 汉宁(von Hann)窗

转载 作者:行者123 更新时间:2023-11-29 05:57:13 32 4
gpt4 key购买 nike

public short[] HanningWindow(short[] signal_in ,int pos ,int size)
{
for (int i= pos; i < pos+size; i++)
{
signal_in[i] = (short) ((signal_in[i]) * ( 0.5 * (1-Math.cos( (2 * Math.PI * i) / (size - 1))))) ;
}
return signal_in;
}

我正在尝试用完它

pos = (ring+delay*frame_rate*frame_size)%(frame_size*(frame_rate+1));
num = record.read(lin,pos,frame_size);

GGSpecSub tempSpecSub = new GGSpecSub();
lin = tempSpecSub.HanningWindow(lin, pos, frame_size);

这是我第一次使用实时 DSP - 请告诉我这是否是将汉宁窗应用于信号的正确方法?

最佳答案

不,它需要更像这样:

public short[] HanningWindow(short[] signal_in, int pos, int size)
{
for (int i = pos; i < pos + size; i++)
{
int j = i - pos; // j = index into Hann window function
signal_in[i] = (short) (signal_in[i] * 0.5 * (1.0 - Math.cos(2.0 * Math.PI * j / size)));
}
return signal_in;
}

关于java - 汉宁(von Hann)窗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11600515/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com