通过实施核心音频后处理的低通滤波器 [英] Implementing a post-processed low-pass filter using core audio
问题描述
我已经实现使用基于时间值一个基本低通滤波器。这是好的,但试图找到正确的时间片是猜测,并给出了基于不同的输入音频文件不同的结果。以下是我现在有:
I have implemented a rudimentary low-pass filter using a time based value. This is ok, but trying to find the correct time slice is guess work, and gives different results based on different input audio files. Here is what I have now:
- (void)processDataWithInBuffer:(const int16_t *)buffer outBuffer:(int16_t *)outBuffer sampleCount:(int)len {
BOOL positive;
for(int i = 0; i < len; i++) {
positive = (buffer[i] >= 0);
currentFilteredValueOfSampleAmplitude = LOWPASSFILTERTIMESLICE * (float)abs(buffer[i]) + (1.0 - LOWPASSFILTERTIMESLICE) * previousFilteredValueOfSampleAmplitude;
previousFilteredValueOfSampleAmplitude = currentFilteredValueOfSampleAmplitude;
outBuffer[i] = currentFilteredValueOfSampleAmplitude * (positive ? 1 : -1);
}
}
我能做些什么来转换这个code到code,让我通过一定的分贝水平削减超过一定频率赫兹?
What can I do to convert this code into code that will allow me to cut frequencies over a certain hz by a certain db level?
推荐答案
我强烈建议数字食谱ç。以外的是,我不知道我可以帮你。
I strongly recommend numerical recipes in c. Outside of that, I'm not sure I can help you.
当你设计一个过滤器,需要根据频率来计算滤波器的系数,所以你几乎需要一个类来处理它,而不是只是一个函数。
When you design a filter, you need to calculate the coefficients of that filter based on the frequency so you almost need a class to handle it, not just a function.
这是在 C ++ 但它应该得到你开始。对不起,我不能提供一个具体的答案。
This is in C++ but it should get you started. Sorry I can't provide a concrete answer.
这篇关于通过实施核心音频后处理的低通滤波器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!