【发布时间】:2011-03-03 15:09:51
【问题描述】:
我有一系列 int 样本,范围从 32766 到 -32767。在尝试创建包络检测器的过程中,我编写了一个低通滤波器,但它似乎并没有起到作用。请记住,我正在尝试一次性过滤整个数组(无缓冲区)。
这不是流式传输的,而是应用于录制的音频以供以后播放。它是用 C 语言编写的。一个示例截止参数是 0.5。
void lopass(int *input, float cutoff, int *output)
{
float sample = 0;
for (int i=1 ; i < (1430529-10); i++) // we will go through all except the last 10 samples
{
for (int j = i; j < (i+10); j++) { // only do this for a WINDOW of a hundred samples
float _in = (float)input[j];
float _out = (float)output[j-1];
sample = (cutoff * _in) + (32766 - (32766*cutoff)) * _out;
}
output[i] = (int)sample;
}
}
我想我会在 10 个样本的窗口上运行我的过滤语句。它不仅超级慢,而且它并没有真正做太多,但似乎降低了整体幅度。 \
如果您对如何正确执行此操作有任何建议或建议(或代码!),那就太好了!
【问题讨论】:
标签: c audio signal-processing lowpass-filter