A Collection of Useful C++ Classes for Signal Processing

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

Post

Ok, downloaded the newest repository from gitHub, was able to compile the demo without problems now. But I'm still getting the same LNK error when including the libraries in VS in my other projects. Is it possible to get a guide for including the correct directories in VS2010?

Right now I have included ..\shared\DSPFilters\include\ under "include directories" in VS directories and C/C++ Additional directories.

Under library directory I have
..\shared\DSPFilters\Builds\VisualStudio2010\DSPFilters-Output\Products\Win32Debug\

Post

I suppose I should make things more clear.

There are no libraries...you just add the one source file dsp_filters.cpp to your project, and that's it!

Post

Hi @all,

I have a problem:
I would like to use the Biquads of DSP Filter Collection. The coeffitions are calculated in Matlab. Now I would like to use the processing function, but I get an error. Can anybody help me?

here is a piece of my code:

Dsp::SimpleFilter <Dsp::Biquad> f;

f.m_a0 = 1;
f.m_a1 = -0.429505606373874;
f.m_a2 = 0.018873495617706;
f.m_b0 = 0.410661824744250;
f.m_b1 = 0.195256063309422;
f.m_b2 = -0.080178128348266;

f.process(256, ImpResponses);

this is the error I get : "attempt to process empty ChannelState"


Best Regards
Valentin

Post

Here is the declaration for SimpleFilter:

Code: Select all

template <class FilterClass,
          int Channels = 0,
          class StateType = DirectFormII>
You need to specify the number of channels in the template arguments, or else it will default to 0. So if you want a two-channel filter, use this definition:

Code: Select all

Dsp::SimpleFilter <Dsp::Biquad, 2> f;

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
thevinn wrote:I suppose I should make things more clear.

There are no libraries...you just add the one source file dsp_filters.cpp (https://github.com/vinniefalco/DSPFiltersDemo/blob/master/DSPFilters/modules/dsp_filters/dsp_filters.cpp) to your project, and that's it!
Thanks for the help, I now got it to work.

Post

@thevinn

thanks a lot. This is the solution for my problem.


Best Regards
Valentin

Post

I've just started using your DSPFilters library and am impressed with the simple interface and fast results. I'm somewhat familiar with the internals of DSP filters, but would really appreciate a little help with computing a couple parameters:

For a given filter type, is there an interface that returns (or a way to calculate) the window size that the filter uses? I am using the filters on a limited number of samples and need the filter to be at steady state all the way to the ends of the sample set, so I'll be mirroring and extending the data set on each end. It would be helpful to know how to calculate how many samples the set needs to be extended by.

Also, the phase shift of each of the filters seems to be dependent on cutoff frequency. Is there a way to calculate the number of samples that the set is delayed by after passing through the filter?

Thanks in advance for your help.

Post

These are infinite impulse response filters...not sure if a "window" is applicable (can someone confirm?)

Post

Hey Vinnie, a couple of things I noticed, while playing with DSP Filters Demo MacOS X (0.9.71—didn't check if there was a new one). I was looking at the shelves, while thinking about tweaks to my shelving filters, and noticed:

1) For High Shelf, the FC is reversed—moving the Fc up moves the poles and zero down.

2) For both the high and low shelves, the gain and boost cases are asymmetrical. This is due to RBJ's cookbook not taking the phenomenon into account—nothing you did wrong in your implementation. The correct thing to do is to invert H(s) for the boost cases. If it's not clear what I mean by asymmetrical cut/boost, consider that you want to keep the corner of the shelf (the corner nearer the boost or cut level, not the one near 0 dB) at a constant frequency as you boot or cut.

Take a look at

http://www.earlevel.com/main/2010/12/20 ... alculator/

Set Plot to "log" (to make it easier to see the corner), and play with the low and high shelves. (I really should add some sliders to this to make it quicker and easier to show how the parameters affect response.) You can see how I select the appropriate response in the code here—again, it's just a matter of inverting the transfer function:

http://www.earlevel.com/main/2011/01/02 ... -formulas/

I don't have "Q" (slope) in my versions; although the case of slope < 1 appears to be musically useful, I don't think the case for > 1 is the best choice of how to handle the general case. I think that most (all?) EQs that allow this are mimicking certain vintage analog responses, for which you have a bump near 0 dB, but a smooth transition near the shelf level (not bumps both places). Basically, that means implementing Q on one side of the transfer function—you need to factor in the gain setting too, if you want a more reasonable control interaction.

Anyway, I'm not suggesting that you do all this, necessarily—it may well be beyond the scope of the app/lib. But I thought I'd pass on the tips, since I was mucking about with shelving ideas last weekend. If you were to implement one thing, it would be making the response symmetrical—the boost cases are not musically "correct" in any sense I can think of (you set the frequency you want, then as you boost the gain, the frequency slides somewhere else).
My audio DSP blog: earlevel.com

Post

Thanks for the feedback.

1) DSP Filters is due for a massive rewrite

2) Looking back, I think that the way I used templates and factored the classes could have been done a lot better. For example, it is not clear how to extract the coefficients even though this is a very common use-case.

3) The code is not well documented

4) There are some bugs with the implementation (you found one)

5) There are numerous improvements that can be made to the GUI and the C++ interface (suggested by various people over the last year based on usage needs).

6) I only scratched the surface of filter design, just getting "something" in place for each of the basic types. It is certainly possible to greatly expand the number of ways that filters can be specified, there's a lot of literature out there that I can incorporate.

7) There's not much in terms of filters ready to use for synth applications. Where's Andy's state variable filter?

8 ) Since half the use-cases of these filters is for synthesis purposes, it would make sense for me to at least include a basic working synth in the demo application. This would also be a great way to show use-cases for VFLib.

I don't have the time to get around to this now but when I look at it again I will go through this and other threads and try to incorporate everyone's feedback.

Post

Ah, true. Thank you for the quick response. Is the full library IIR, or do you have some FIR filter types as well?

Post

thevinn wrote:Thanks for the feedback.

1) DSP Filters is due for a massive rewrite
...
8 ) Since half the use-cases of these filters is for synthesis purposes, it would make sense for me to at least include a basic working synth in the demo application. This would also be a great way to show use-cases for VFLib.

I don't have the time to get around to this now but when I look at it again I will go through this and other threads and try to incorporate everyone's feedback.
Very cool, Vinnie. BTW, if you need an oscillator, you're welcome to use

http://www.earlevel.com/main/2012/05/25 ... —the-code/
My audio DSP blog: earlevel.com

Post

twilson wrote:Ah, true. Thank you for the quick response. Is the full library IIR, or do you have some FIR filter types as well?
From README.md:
* Exclusive focus on IIR filters instead of boring FIR filters
One can literally bury themselves in the mountain of available open source FIR code, but there's a dearth of good IIR stuff which is why I wrote DSPFilters.

Post

IIR is working out great for what I'm doing. Thanks again.

Post

Vinn, just wanted to add to the chorus of praise here. Your library is certainly the easiest way to start using filters in a C++ application, and that's great for newbs like me. If you're planning a rewrite to include more functionality, well that's even better. Thanks dude!

Post Reply

Return to “DSP and Plugin Development”