A Collection of Useful C++ Classes for Signal Processing

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

Post


Post

Code: Select all


f = new Dsp::SmoothedFilterDesign <Dsp::RBJ::Design::HighPass, 2> (1024);

params[0] = SAMPLE_RATE; 
params[1] = freq; 
params[2] = 1.25; 
f->setParams (params);

void ProcessReplacing(float** inputs, float** outputs, int nFrames)
{

   ...

   f->process (nFrames, inputs);
   
   ...


}

in smoothedfilter.h, line 79:

Code: Select all

int remainingSamples = std::min (m_remainingSamples, numSamples);
errors:
error C2589: '(' : illegal token on right side of '::'
error C2059: syntax error : '::'
Last edited by user125 on Wed Jun 10, 2015 1:24 pm, edited 1 time in total.

Post

Must be missing the cmath header.

Post

No, including <cmath> and <algorithm> to this header doesn't change anything.

Post

Visual Studio? If yes, it can be that min and max are macros and not functions (older VS versions have that).
Try:
#undef min
#undef max

just before, or remove std::

edit: http://stackoverflow.com/questions/5004 ... ives-error

Post

Excelent. :-)

Post

Don't use undef, use #define NOMINMAX before you include <windows.h>.

Alternatively, don't include <windows.h> at all because there is no reason to do so outside your dllmain or winmain function, which should be in its own source file.

The windows header also causes trouble with stdint defines and many others. In larger projects accidentally including this header leads to major issues.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

Thanks guys! By setting "/bigobj" and "Navigate to C/C++ -> Preprocessor. Select Preprocessor Definitions and add _XKEYCHECK_H;" I was able to build it in VS2010!

Post

Does anybody know how to actually include this library inside project? I am getting LNK2019 error in MVS2013, and don't tell me to include dsp_filters.cpp as this doesn't exist in library... :)

https://github.com/vinniefalco/DSPFilters

Post

@julijannikolic What specific problem with linking are you having? If you built it as a .lib, you would need to list it in the Linker, Additional Dependencies under your project's Properties. I simply include all of DSPFilters source code in my project, so there's no problem with finding it.

Post

Is there anywhere a class similar to SimpleFilter that allows smooth parameters changes.
I think I need a class that can do switching between different filter types, but wouldn't like to write it, since someone probably has done it already.

Post

Switching filter types is not a simple problem to solve. Since different filter types have different phase, amplitude and group delay in many cases it is simply impossible to switch without introducing a discontinuity.

You could eliminate the zero order discontinuity although the filter state required to produce an identical output likely isn't a match to the current input signal or parameters. Due to that, you'll just end up with a 1st order or other discontinuity as the filter needs to stabilize again after the switch.

You might be best implementing a simple cross-fade.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

Any idea how it's done in DSPFiltersDemo?
Can't seem to understand it.

Post

I can't help you there, I've never seen the code.

If for example you have filters that have equal group delay...

For example a low-pass and high-pass filter.

You can set the state of the filter to equal the last output value when switching modes and from that point it should charge to the correct position.

For example low-pass with i/o = 1, high-pass state can be set to = 1 where it will then move toward 0.

The other way, high-pass with i = 1, o = 0, low-pass state can be set to = 0 where it will move toward 1.

This will only work if the delay is equal though and it will only eliminate the zero order discontinuity. If you have a sine-wave input for example the amplitude will very quickly diverge after you've switched modes.

If you want to ensure you filter any transient of any order below some threshold you'll need to use a longer cross-fade.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

Can you use the DSP::Filter::process function for numSamples = 1?
In real-time processing this is often the case that the samples are being read through one at a time, so can they be filtered one by one?

Or what would be the way to do filtering in real-time?

My use case is similar to this: http://www.kvraudio.com/forum/viewtopic ... 1#p6155174

BTW, would be helpful if there was some compilation of examples using the library. Can't seem to find many.

Post Reply

Return to “DSP and Plugin Development”