A Collection of Useful C++ Classes for Signal Processing

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

thevinn wrote: IIR filters with low cutoffs definitely start getting wacky especially as the order increases. I think the typical solution is "oversampling".

Can anyone confirm or deny this?
I'll deny the part about oversampling. The filter "core" only really sees a normalized frequency, and oversampling will make the low normalized frequency even lower. This is make the problem worse!

Anyway, this problem is dependent on the filter structure. Direct forms are probably some of the most sensitive (of the commonly used structures anyway). Like I said in the previous post, I've been meaning to write a tutorial on how to take an arbitrary set of direct form coeffs and map it to arbitrary filter structure (it's not exactly very hard in most cases).

Basic "general" outline is to define the filter in state-space form and take the inverse of (zI-A) and then multiply with input/output vectors, add direct path, and solve for whatever unknowns you have so that the response matches. In some cases (uum, ladders/lattices) there are also published formulas to do it directly (though the state-space approach works too).

Post

thevinn wrote:IIR filters with low cutoffs definitely start getting wacky especially as the order increases. I think the typical solution is "oversampling".

Can anyone confirm or deny this?
No, oversampling atually lowers the frequency in terms of a ratio of the samplerate. The solution is in my limited experience is to run the filteras as a cascade of lower order filters or to increase the bit depth.

Post

To improve the ratio, one could downsample, filter, then oversample back to original fs again... ;)
Image

Post

duncanparsons wrote:To improve the ratio, one could downsample, filter, then oversample back to original fs again... ;)
cool, any info over 10kHz is over commercialized anyway :D

Post

matt42 wrote:
duncanparsons wrote:To improve the ratio, one could downsample, filter, then oversample back to original fs again... ;)
cool, any info over 10kHz is over commercialized anyway :D
We're talking about low cutoffs right? Not much info over 10Khz.

Post

DavenH wrote:
matt42 wrote:
duncanparsons wrote:To improve the ratio, one could downsample, filter, then oversample back to original fs again... ;)
cool, any info over 10kHz is over commercialized anyway :D
We're talking about low cutoffs right? Not much info over 10Khz.
The problem does affect high-pass filter equally though (the poles are typically the same or at least close to what you'd have with bandpass/lowpass). When you need a low-cutoff high-pass, you probably don't want to downsample. :P

Post

Okay, so to be clear, there is no actual defect in the DspFilters code?

Post

ok, so i tried to use this. First off, I put the DspFilters folder into my project. I took out the files from the include folder and put them in the main DspFilter folder, and took out the Source stuff and put that in the DspFilter folder. I had to change this, because all the documentation shows is to include "#include "DspFilters/Dsp.h"" which clearly doesn't exist. Its in the include folder.

So then I go to compile and get:

Code: Select all

Dsp::SmoothedFilterDesign<Dsp::RBJ::Design::HighPass, 2> *m_hipassfilter;
m_hipassfilter=new Dsp::SmoothedFilterDesign<Dsp::RBJ::Design::HighPass, 2> (512);
Dsp::Params params;
 params[0] = 44100; // sample rate 
    params[1] = 5; // order 
    params[2] = 4000; // corner frequency 
    params[3] = 6; // shelf gain 
    params[4] = 0.1; // passband ripple 
    f->setParams (params); 


//-------------------------------

1>.\LoJo.cpp(30) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\LoJo.cpp(30) : error C2040: 'm_hipassfilter' : 'int' differs in levels of indirection from 'Dsp::SmoothedFilterDesign<DesignClass,Channels> *'
1>        with
1>        [
1>            DesignClass=Dsp::RBJ::Design::HighPass,
1>            Channels=2
1>        ]
1>.\LoJo.cpp(30) : error C2440: 'initializing' : cannot convert from 'Dsp::SmoothedFilterDesign<DesignClass,Channels> *' to 'int'
1>        with
1>        [
1>            DesignClass=Dsp::RBJ::Design::HighPass,
1>            Channels=2
1>        ]
1>        There is no context in which this conversion is possible
1>.\LoJo.cpp(32) : error C2466: cannot allocate an array of constant size 0
1>.\LoJo.cpp(32) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\LoJo.cpp(32) : error C2040: 'params' : 'int []' differs in levels of indirection from 'Dsp::Params'
1>.\LoJo.cpp(32) : error C2440: 'initializing' : cannot convert from 'int' to 'int []'
1>        There are no conversions to array types, although there are conversions to references or pointers to arrays
1>.\LoJo.cpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\LoJo.cpp(33) : error C2040: 'params' : 'int [1]' differs in levels of indirection from 'Dsp::Params'
Any ideas? Still not sure why it says "include DspFilters/dsp.h", when that file doesn't even exist.. Shouldn't it say "include DspFilters/include/dsp.h" ???

~Rob.

Post

Rob:

Not sure what your exact problem is, but did you try compiling the demo project for your platform?

Post

Yeah, it worked fine. So, I take the downloaded filter code, move the include and source files into the main DspFilter folder, right? Even the example says:

"
// This is the only include you need
#include "DspFilters/Dsp.h"
"

That file doesn't exist....

Image

So i must be doing something wrong.

The file is actually here: #include "DspFilters/include/DspFilters/dsp.h"

Which screws up all the other includes... ughh

EDIT: set additional libraries path to include folder. But still getting the same errors....

Code: Select all

.\LoJo.cpp(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\LoJo.cpp(12) : error C2040: 'm_hipassfilter' : 'int' differs in levels of indirection from 'Dsp::SmoothedFilterDesign<DesignClass,Channels> *'
1>        with
1>        [
1>            DesignClass=Dsp::RBJ::Design::HighPass,
1>            Channels=2
1>        ]
1>.\LoJo.cpp(12) : error C2440: 'initializing' : cannot convert from 'Dsp::SmoothedFilterDesign<DesignClass,Channels> *' to 'int'
1>        with
1>        [
1>            DesignClass=Dsp::RBJ::Design::HighPass,
1>            Channels=2
1>        ]
1>        There is no context in which this conversion is possible
1>.\LoJo.cpp(14) : error C2466: cannot allocate an array of constant size 0
1>.\LoJo.cpp(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\LoJo.cpp(14) : error C2040: 'params' : 'int []' differs in levels of indirection from 'Dsp::Params'
Dsp::SmoothedFilterDesign<Dsp::RBJ::Design::HighPass, 2> *m_hipassfilter;

That line throws this warning: warning C4101: 'm_hipassfilter' : unreferenced local variable

Post

You need to add "DspFilters/include/" into your compile/build systems list of include paths. For example -I"DspFilters/Include" command line option (I think)

Post

Solved... And getting things in the right place in my plugin class... thanks..

Post

Try making sure your r-values are of type double when you assign to params

Post

Are there even peak filters in this?

Post

robrokken wrote:Are there even peak filters in this?
Peak filter? You mean a mid-band shelf filter? Yes there is.

Post Reply

Return to “DSP and Plugin Development”