I currently work in a project of clinical software (C#) which deals with clinical biosignals, specifically EMG and other low-frequency signals (load-cells, goniometers, and other biomechanical instruments).

We have to be able to:

  • Create filters based on cuttoff frequencies (low and high) and filter order, for a given sampling frequency; The band-pass could be a cascading of one low-pass and one high-pass filters;
  • Apply filters in real-time, that is, adding a new input sample and immediately taking a new output sample, in a loop;

I have read a lot about filter types, but explanations are usually based on math notation, while I would need a more computational explanation.

Also, reading source code (mostly from Octave-Forge) I can only "see" a lot of numbercrunching without actually understanding what is happening.

As I understand (correct me if I am wrong), an implementation of what I need would involve:

  • Choose some input parameters for filter creation, that is, Low Frequency, High Frequency, Sampling Rate, and Filter Order;
  • Execute some magic operation on these parameters, that would give me a recurrence relation; This recurrence relation would be contained in an instance of a filter;
  • This filter instance would have a buffer of size N. As I start to collect data, the following loop would start to run:
    • Add new input sample to filter;
    • Apply recurrence relation;
    • Read new output sample;

So what I have to ask is:

  • Does my computational rationale about filter design and usage (as explained in the bullet-list just above) makes sense from a DSP perspective? That is, would it be a feasible plan to implement some Filter class according to such rationale?

  • Which concepts should I know / read about in order to properly implement such filter? For example, I understand that recurrence relation, order, sampling rate, (implicit) impulse response, are a bare minimum to define a filter, but I also read about number of taps, poles and zeros, gain, direct form, cascaded sections, and I am not sure it is necessary to deal with all the concepts to satisfy my requirements.

  • Is there any conceptual topic or resource (link, book) I should take a look? Preferrably one focusing on implementation (that is, without heavy math notation)?

  • $\begingroup$ If this question is poorly formulated, please tell me so that I can rephrase it. $\endgroup$ – heltonbiker Jul 31 '14 at 17:11
  • $\begingroup$ It's not clear what you're actually asking. I don't see any question marks in your post at all. $\endgroup$ – Jason R Jul 31 '14 at 17:55
  • $\begingroup$ @JasonR I added a block with questions, thanks for pointing it out. $\endgroup$ – heltonbiker Jul 31 '14 at 18:12
  • 2
    $\begingroup$ Your inquiry is very broad. You would be best served by researching a bit more and coming up with more pointed questions. $\endgroup$ – Jason R Jul 31 '14 at 18:47
  • $\begingroup$ Digital signal processing is a lot of number crunching so it is difficult to avoid the math notation. Generally DSP algorithms involve a lot of operations on vectors and/or matrices. You need to choose a platform to do the work in and get familiar with how the math is represented in that platform. You will probably find a "toolkit" for the platform that has a lot of ready made algorithms. Here is a decent reference you can read online: dspguide.com $\endgroup$ – user2718 Jul 31 '14 at 18:51

Your bullet list makes sense and you seem to have the right idea. I think you mostly want a link that will show you how to get started, so let me suggest this.

First, start with an FIR filter. A very good FIR filter can be generated with as little as 10 lines of code, and implemented with another 10 lines of code. Basically, with FIR, if it's complicated, you are doing it wrong.

This link has source code for Windowed FIR, Parks McClellan FIR, and IIR filters, as well as code for implementing both FIR and IIR filters. Start with the Windowed FIR. They work great and are the simplest to generate.


  • $\begingroup$ Thanks, I'm gonna take a look, these seem promising. As I said in other comments, I have a little additional reading to do, so that I can better understand the content on the linked page in the first place. Thank you very much so far! $\endgroup$ – heltonbiker Aug 1 '14 at 22:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.