I'm working on a DSP class (obj-c++) for Novocaine, but my filters only seem to cause noise/distortion on the signal.
I've posted my full code and coefficients here: https://gist.github.com/2702844 But it basically boils down to:
// Deinterleaving...
// DSP'ing one channel:
NVDSP *handleDSP = [[NVDSP alloc] init];
[handleDSP setSamplingRate:audioManager.samplingRate];
float cornerFrequency = 6000.0f;
float Q = 0.5f;
[handleDSP setHPF:cornerFrequency Q:Q];
[handleDSP applyFilter:audioData length:numFrames];
// DSP other channel in the same way
// Interleaving and sending to audio output (Novocaine block)
See the gist for full code/context.
The coefficients:
2012-05-15 17:54:18.858 nvdsp[700:16703] b0: 0.472029
2012-05-15 17:54:18.859 nvdsp[700:16703] b1: -0.944059
2012-05-15 17:54:18.860 nvdsp[700:16703] b2: 0.472029
2012-05-15 17:54:18.861 nvdsp[700:16703] a1: -0.748175
2012-05-15 17:54:18.861 nvdsp[700:16703] a2: 0.139942
(all divided by a0
)
Since I presumed the coefficients are in the order of: { b0/a0, b1/a0, b2/a0, a1/a0, a2/a0 }
(see: IIR coefficients for peaking EQ, how to pass them to vDSP_deq22?)
What is causing the distortion/noise (the filters don't work)?
Update: I recommend everyone to use my DSP class I released on github: https://github.com/bartolsthoorn/NVDSP It'll probably save you quite some work.
Got it working, woooo! Long live the japanese: http://objective-audio.jp/2008/02/biquad-filter.html
The applyFilter method had to be:
Full class: https://github.com/bartolsthoorn/NVDSP