A Collection of Useful C++ Classes for Signal Processing

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

Post

As somebody who needs to create a large bandpass filter bank using narrow elliptic type filters to replace my power hungry FFT filters, I ran across the DSPFilters Juce app and source code on the web. This is great. And a very nice app with anti-aliased lines and everything. Thank you to thevinn.

I too wanted it to dump out the coefficients so the last several posts are also very useful to me I hope, although I program in normal C and assembly, and not C++ which I can't stand, hopefully the examples provided can give me what I want without me debating whether I want to fork out $300 for ScopeIIR. Glad I decided to follow the docs and come here to KVR to check out the forum.

Class templates? Polymorphism? Introspection? Inheritance? Wrappers? Yep, leave it to C++ to turn something simple into something complex, confusing and ugly.

Thanks again,
-Elhardt

Post

Working on the Bahn Sage 2.0?
Elhardt wrote:Class templates? Polymorphism? Introspection? Inheritance? Wrappers? Yep, leave it to C++ to turn something simple into something complex, confusing and ugly.
???

Post

Elhardt wrote:Class templates? Polymorphism? Introspection? Inheritance? Wrappers? Yep, leave it to C++ to turn something simple into something complex, confusing and ugly.
Good thing you didn't see what it was like before this latest rewrite!

Post

Hi! I saw your project on Google and I am very interested about it. I want to understand is your code applicable to my task.

I have input device (Microsoft Kinect) that sends me coordinates of tracked object. The sequence of coordinates is noisy. Useful signal here is object movement.

Noise has following characteristics (relative to useful signal):
  1. It is random
  2. It has small magnitude
  3. It has high frequency
I want to remove noise and make movements smooth. Problem here is that I have to filter signal in real time and I have to smooth values in i-th time point based only on past values in time range [0; i] (Of course in reality I would use [i-n; i] values).

So the question is: is it possible to use your library to filter stream of data using low pass filter?

Thanks,
Andrey

Post

@Jabberwok:
You also might want to try a 'kalman filter,' they are used for tracking systems like GPS positioning. I've not tried them, but there's a lot of information here:
http://www.cs.unc.edu/~welch/kalman/
It's supposed to be very good at movement prediction within noisy data.

Dave

Post

Thanks, I will check that. I am particularly interested in "A Collection of Useful C++ Classes for Signal Processing" because it might fit my needs and I can avoid writing additional code :)

Post

c++ uglyness? i think not.

Code: Select all

	template <int X, int Y>
	struct tf_pow
	{
		enum { value = X * tf_pow<X, Y-1>::value };
	};

	template <int X>
	struct tf_pow<X, 1>
	{
		enum { value = X };
	};
this is a thing of beauty for sure. being able to execute logic at compile-time is extremely useful. it's just that most people don't have a clue how to use it

:hihi:

c++ templates are turing complete.

this extension of the use of templates won't be required anymore with the next c++ version which will have a constexp specifier which allows you to specify functions executed at compile time to for example, populate tables or calculate a power as my example above.
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

I have input device (Microsoft Kinect) that sends me coordinates of tracked object. The sequence of coordinates is noisy. Useful signal here is object movement.

Noise has following characteristics (relative to useful signal):


It is random
It has small magnitude
It has high frequency

I want to remove noise and make movements smooth.
I discussed a very similar project not so long back right here on KVR:
http://www.kvraudio.com/forum/viewtopic ... 03#4392103

In the end I went with an EWMA filter with a dynamically-adjusted coefficient. I didn't find any filters from the audio DSP field to be as effective or as simple to implement. Feel free to drop me a PM, I'm interested to hear more about object tracking with Kinect as we'd like to add it to our app.

Kind regards
Dave

Post

Perhaps somebody can help me. I'm having no luck using this DSPFilter code to get coefficients, which I had pretty much predicted. None of the syntax in the code that was posted can be recognized by the compiler. But before I go further I need to find out if I have the latest source code. I downloaded the folder DspFilters_FullSource_0.9.5b. But I keep seeing mention of some SVN trunk, and that some SVN check needs to be run for updates. I need somebody to tell me what the hell SVN is, where the trunk is, and how I run the SVN check/ update. Thanks for any help.

Post

aciddose wrote:c++ uglyness? i think not.
C++ certainly *can* be ugly, although it doesn't have to be. I've been doing some linear algebra for an OpenGL app and it's far, far, nicer with a good C++ template library for vectors & matrices than it would be in straight C.

As for polymorphism, a good rule of thumb is to try to avoid having more than two levels in your inheritance hierarchy.

Post

kuniklo wrote:C++ certainly *can* be ugly, although it doesn't have to be. I've been doing some linear algebra for an OpenGL app and it's far, far, nicer with a good C++ template library for vectors & matrices than it would be in straight C.

As for polymorphism, a good rule of thumb is to try to avoid having more than two levels in your inheritance hierarchy.

Again, I program in C, not C++, so most of what you're saying is Greek to me. A computer programming language is a set of instructions to accomplish a task. If you need to do linear algebra, I really can't believe that C++ is so magical that it will do it for you. In C, you use functions. Write it once and call it. I can't see how a "template library" would be different than a C library. Aciddose put up some cryptic ugly looking code, then called it a thing of beauty. I don't think so. Compare to what a template looks like in C, Fortran, Pascal, Forth, Etc. between the ----- lines below:

-------


-------

Look how clean that is, because it doesn't even exist. The cleanest code of all is that which doesn't exist.

As for polymorphism and inheritance, again, it is not relevant to anything I've ever needed nor even part of my terminology. That's what C++ does, it imposes a bunch of limits, then makes you jump through hoops to get around them. Just like templates, I don't have to limit myself to two levels of inheritance because such a thing doesn't apply to my programming. I've been programming computers for 30 years and have written commercial apps that are on the market and not once did I ever think to myself "I just can't program what I want because I don't have inheritance, polymorphism, name spaces, templates, data abstraction, over loading, classes, methods, and all that nonsense". Bloated and convoluted code is not something I'll ever be attracted to. Every line of code should get you one step closer to the goal and substance of the app, not be a bunch of extraneous and superfluous constructs, organizations, definitions, punctuation, and so forth.

It used to be a line of code looked like:

a=b+c

Now it looks like:

*pfVAriable->(customVAR)a=uGly_ass_VariableTYPE->*ptDDSD.sub[iPTR]+(float *)c;

Now really, which one is easier to understand, faster to type in, takes less memory, executes faster, and is nicer to look at?

****

NOW IF I COULD JUST GET SOMEBODY TO ANSWER MY QUESTION ABOUT SVN UPDATER and WHERE DO I FIND IT AND HOW DO I USE IT. I seem to have confirmed that the .zip file is not up to date and that's why I can't get coefficients out of it. So somebody, please let me know how to accomplish that. Thanks.

Post

SVN is a version control system, bastard son of CVS, on non-speaking terms with mercurial, git, and various others.

There are many SVN programs available, and will be one for your platform. TortoiseSVN is highly regarded on win, as its explorer integration is very useful. SmartSVN is java based and available for a number of platforms. I quite like SmartSVN.

The sourceforge page for DSPFilters will have the URI for an SVN program to use, then you specify a local directory, and you can download a copy of the repository which may well have fixes that supersede the official releases.

That help? :)

btw, do I recall from years previously that you are indeed that Elhardt of the Sage fame? If so, I applaud your ingenuity - that was a masterpiece [I'm serious, I thought it marvellous :)]
Image

Post

I am still waiting to buy my Bahn Sage, why has it not been released yet :x

:hihi: :hihi: :hihi:

Post

Elhardt wrote: It used to be a line of code looked like:

a=b+c

Now it looks like:

*pfVAriable->(customVAR)a=uGly_ass_VariableTYPE->*ptDDSD.sub[iPTR]+(float *)c;

Now really, which one is easier to understand, faster to type in, takes less memory, executes faster, and is nicer to look at?
Ironically the whole point of C++ is that it allows you to keep on writing a = b + c for types the compiler implementer never dreamed of. Well written C++ is far more explicit and legible than the equivalent C code.

I too have been writing code for 30 years and have shipped commercial apps in many languages on many platforms. C++ is far from my favorite language but, like it or not, it remains the best choice for many problem domains. There's a reason every commercially significant native desktop app is written in C++ and not C.

SVN is garbage, btw. Go with git or mercurial if you have any say in the matter.

Post

kuniklo wrote:SVN is garbage, btw. Go with git or mercurial if you have any say in the matter.
Hows the Visual Studio integration with those?

Post Reply

Return to “DSP and Plugin Development”