我有这6个峰值均衡系数:
b0 = 1 + (? ? A)
b1 = ?2??C
b2 = 1 - (? ? A)
a0 = 1 + (? / A)
a1 = ?2 ? ?C
a2 = 1 ? (? / A)
Run Code Online (Sandbox Code Playgroud)
有了这些中间变量:
?c = 2 ? ? ? fc / fs
?S = sin(?c)
?C = cos(?c)
A = sqrt(10^(G/20))
? = ?S / (2Q)
Run Code Online (Sandbox Code Playgroud)
vDSP_deq22()应该通过"5个单精度输入,滤波器系数" 的状态记录,但我有6个系数!另外,我以什么顺序将它们传递给vDSP_deq22()?
更新(17/05):我建议大家使用我在github上发布的DSP类:https://github.com/bartolsthoorn/NVDSP它可能会为你节省很多工作.
我正在移植一个过滤器库,该过滤器库目前使用Apple特定的(加速)vDSP功能vDSP_deq22到Android(其中Accelerate不可用).滤波器组是一组带通滤波器,每个滤波器滤波器返回其各自频带的RMS幅度.目前代码(ObjectiveC++,改编自NVDSP)如下所示:
- (float) filterContiguousData: (float *)data numFrames:(UInt32)numFrames channel:(UInt32)channel {
// Init float to store RMS volume
float rmsVolume = 0.0f;
// Provide buffer for processing
float tInputBuffer[numFrames + 2];
float tOutputBuffer[numFrames + 2];
// Copy the two frames we stored into the start of the inputBuffer, filling the rest with the current buffer data
memcpy(tInputBuffer, gInputKeepBuffer[channel], 2 * sizeof(float));
memcpy(tOutputBuffer, gOutputKeepBuffer[channel], 2 * sizeof(float));
memcpy(&(tInputBuffer[2]), data, numFrames * sizeof(float));
// Do the processing
vDSP_deq22(tInputBuffer, 1, coefficients, tOutputBuffer, 1, numFrames);
vDSP_rmsqv(tOutputBuffer, …Run Code Online (Sandbox Code Playgroud)