A Collection of Useful C++ Classes for Signal Processing

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

Post

thevinn wrote:
Xenakios wrote:I wanted the code to dynamically adjust the channel count at runtime. But now, of course the number of channels used by the library is a template parameter, so you might see what that lead into...
The intent is that you set the template argument to the MAX number of channels you might want to process and then pass a smaller number later with the actual number of channels to process.
Which class/method has that chance to later set the number of channels to process? Sorry, it might be something obvious I've missed so far. (Even then, there might be some additional resource usage if the template parameter is set to, say 32 channels, but only 1 or 2 channels are later used...?)

Post

I'm not really sure, I am still studying this mess to try to figure out what I was thinking. I'm contemplating rewriting it to use the standard library a bit more, no reason why the number of channels can't be determined at run time, and use classes like `vector` and what not.

Post

How can you do bode plots of the DSPFilters filters?
Any pointers?

Post

Get the coefficients parameters and Python/Matlab ;)

Post

Miles1981 wrote:Get the coefficients parameters and Python/Matlab ;)
But the lib actually does them, since the Demo has the bode plots.
I'm also seeing some call to m_Filter->response, which I take to return the transfer function or something. What I was asking was someone to perhaps clarify, how it should be done.

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.
Hi,
I am getting weird results from some filters.

I have tested the following filter design:

Code: Select all (#)

		Dsp::SimpleFilter<Dsp::Butterworth::HighPass<1>, 1> filter_;
		filter_.setup(1, 23.0, 0.1);
		double* channels [1];
		channels[0] = &impulseSignal[0];
		filter_.process(impulseSignal.size(), channels);
I passed this input to the filter:

Code: Select all (#)

	std::vector<double> impulseSignal = {
							  0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,	  0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
							};
This is the expected output (obtained thru MATLAB):

Code: Select all (#)

	std::vector<double> firstImpulseResponse = {
									 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.986524132,
								    -0.026588539,-0.025871931,-0.025174638,-0.024496138,-0.023835924,
								    -0.023193505,-0.022568399,-0.021960142,-0.021368278,-0.020792366,
								    -0.020231975,-0.019686688,-0.019156098,-0.018639808,-0.018137433,
								    -0.017648597,-0.017172937,-0.016710097,-0.01625973,-0.015821502,-0.015395086,
								    -0.014980161,-0.01457642,-0.01418356,-0.013801288,-0.01342932,-0.013067376,
								    -0.012715188,-0.012372491,-0.012039031,-0.011714558,-0.011398831,-0.011091612,
								    -0.010792674,-0.010501793,-0.010218751,-0.009943338,-0.009675348,-0.009414581,
								    -0.009160841,-0.008913941,-0.008673695,-0.008439923,-0.008212453,-0.007991113,
								    -0.007775739,-0.007566169,-0.007362248,-0.007163822,-0.006970745,-0.006782871,
								    -0.006600061,-0.006422178,-0.006249089,-0.006080665,-0.005916781,-0.005757313,
								    -0.005602144,-0.005451156,-0.005304238,-0.00516128,-0.005022174,-0.004886818,
								    -0.00475511,-0.004626951,-0.004502247, -0.004380903,-0.00426283,-0.00414794,
								    -0.004036146,-0.003927364,-0.003821515,-0.003718519,-0.003618298
									};
I get the following output from the filter:

Code: Select all (#)

9.86524e-09
-1.01311e-08
9.87241e-09
-1.01242e-08
9.87919e-09
-1.01176e-08
9.88562e-09
-1.01113e-08
9.8917e-09
-1.01054e-08
9.89746e-09
-1.00998e-08
9.90291e-09
-1.00945e-08
9.90807e-09
-1.00894e-08
9.91296e-09
-1.00847e-08
9.91759e-09
-1.00802e-08
9.92197e-09
-1.00759e-08
9.92612e-09
-1.00719e-08
-0.986524
0.0265885
0.0258719
0.0251746
0.0244961
0.0238359
0.0231935
0.0225684
0.0219602
0.0213683
0.0207924
0.020232
0.0196867
0.0191561
0.0186398
0.0181374
0.0176486
0.0171729
0.0167101
0.0162597
0.0158215
0.0153951
0.0149802
0.0145764
0.0141836
0.0138013
0.0134293
0.0130674
0.0127152
0.0123725
0.012039
0.0117145
0.0113988
0.0110916
0.0107927
0.0105018
0.0102188
0.00994333
0.00967536
0.00941457
0.00916085
0.00891393
0.0086737
0.00843991
0.00821246
0.0079911
0.00777575
0.00756616
0.00736226
0.00716381
0.00697075
0.00678286
0.00660007
0.00642217
0.0062491
0.00608066
0.00591679
0.0057573
0.00560215
0.00545115
0.00530425
0.00516127
0.00502218
0.00488681
0.00475512
0.00462694
0.00450226
0.00438089
0.00426284
0.00414793
0.00403616
0.00392735
0.00382153
0.00371851
0.00361831
0.00352077
So the weird thing is, the numbers are fine, but the sign is inverted. This happens whenever the order of the filter is odd (1, 3, 5, ...). When the order of the filter is even (2, 4, 6), the sign and the numbers are totally fine.

Any ideas?

Thanks

Post

Anyone understand how would it be possible to control the gain of a filter using an envelope?
E.g. to create an LFO filter?

How do I "route" the envelope to the gain param?

Preferably I'd need to apply the modulation on a per-sample (that is 1 sample) basis.
So to call the filter param setting one sample at a time..?

Post

Hello!
I am newbie in DSP and don't know theory (only somethign about FFT, not about filtering). I have downloaded this library. And wanted to implement it in my application. But I get very weird results. Doesn't matter what filter I use, or what input array I pass to the filter I always get picture, where in the middle of the output array everything is ok, but numbers at the edges of the array increase rapidly. Like on attached image.
dsp.png
You do not have the required permissions to view the files attached to this post.

Post

It's a shame that this library seems to have some bugs in it.

I'm getting the "Smooth" filters shut off output, when their parameters are modulated faster than the interpolation size.

Post

Has anybody recognized that with Butterworth/Bessel/etc. HighPass-Filters with uneven orders the output phase is inverted (180deg)?

I fixed it with inverting the b-vars in BiquadBase::setOnePole, but its probably the wrong fix.

const double b0 = zero.real();
const double b1 = -1;
const double b2 = 0;

Post

Looks like the cascaded High-Shelf & Low-Shelf filters have also phase issues with uneven order-numbers. The phase is completely shifted from low to high, even with gain=0dB.

Post

After further investigation i believe the coefficient calculation in BiquadBase::setOnePole is some how wrong, maybe someone with deeper mathematical knowledge could enlighten me.

Post

Wow! This fixes the low-cut and the high/low-shelf phase problem!

:) :) :) :) I'm a happy man!

viewtopic.php?f=33&t=386712

Post

Suddenly a code using this library that worked earlier is now giving me array out of bounds error.

Is this library "living" somehow, because it seems to break without touching it?

Post

Honestly, I think nobody should use this library anymore. There are a lot of free software around to design classic filters, such as Octave, Scilab, all the dsp python packages... And the results won't have any issue.

Post Reply

Return to “DSP and Plugin Development”