问题描述
您好,我发现此算法为 4 极高通滤波器,对其进行了测试并且可以正常工作,但是我没有找到与他的数学基础或其所基于的算法相关的任何信息。我需要了解我使用的代码片段,所以如果您能提供帮助,我将不胜感激
twopi = 8.0f * atan(1.0f);
float c = (float)exp((-1.0) * twopi * frequency / getSampleRate());
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
auto* outData = buffer.getWritePointer(channel);
auto* inData = buffer.getReadPointer(channel);
for (sample = 0; sample < buffer.getNumSamples(); sample++)
{
input = *(inData + sample) - pole4[channel] * quality;
if (input > 1.0f) input = 1.0f;
if (input < -1.0f) input = -1.0f;
input = 1.5f * input - 0.5f * (input * input * input);
pole1[channel] = input * (1.0f - c) + pole1[channel] * c ;
pole2[channel] = pole1[channel] * (1.0f - c) + pole2[channel] * c;
pole3[channel] = pole2[channel] * (1.0f - c) + pole3[channel] * c;
pole4[channel] = pole3[channel] * (1.0f - c) + pole4[channel] * c;
//The subtraction causes the filter to do a highpass
outputs[channel] = input - pole4[channel];
*(outData + sample) = outputs[channel];
}
// ..do something to the data...
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)