I'm implementing a software similar to a real-time spectrograph with a modified FFT. The output vector summarizes the intensities of various musical tones present in the input signal. Its size is a small constant (compared to the FFT window size) and the values can be continuous. The problem is there is a lot of noise both from the signal itself and from the transformation process. I think that some kind of smoothing could help since the tones that should be emphasized are typically of longer duration and the noisy values vary much from one frame to another.

I've came across the Kalman filter which is used mainly in real-time control systems. It seems to be very powerful. As I've dug into the literature I've gotten unsure if this kind of filter is really suitable for my problem. It seems that the Kalman filter requires modelling the underlying linear process. On the other hand I don't assume any particular process behind the signal. Should I just model a trivial steady-state process or this kind of filter is not suitable?


You can certainly use an adaptive Kalman Filter to identify or remove noise, and there are hundreds of articles on this in the signal processing literature. Whether you need to or not depends on the nature of your task and the noise -- whether the noise is in the frequency range of the signal, whether the noise is signal dependent, etc.

If it were me, unless there were reason to do otherwise, I'd try (in the following order)

1) make sure the signal is good -- i.e., make sure you're doing everything you can to quash the noise before its acquired, and make sure you're not doing something silly, like aliasing your noise into the signal by not acquiring fast enough or prefiltering (which will make your task very difficult

2) Try standard filtering techniques, like FIR and IIR filters to do what you need to do

3) Move on to non-linear, but easy, techniques, like median filtering, Sovitsky-Golay filtering, ..., which might be more tolerant to your noise.

4) Pull out the big guns-- the adaptive filters.

Finding the right filter in tough situations can be a matter of rolling up your sleeves and trying different things.

  • 1
    \$\begingroup\$ Thanks for reply. I've just done the step 1 - fixed a embarassing bug in signal capture which produced a lot of noise. Now the signal is much better and probably some kind of simple filter would be sufficient. However, the adaptive filters are not out of the game, but I'll rather postpone their usage. Anyway your reply was quite useful (the other one too). \$\endgroup\$ – Bohumir Zamecnik Dec 30 '12 at 11:25

A Kalman Filter is great if you don't know all of the states of the system, in actuality it's an adaptive or observer type control system that uses state estimation to fill in gaps left by noise.

Kalman or Luenberger state estimators are great for well defined, high noise, systems where certain states can be observed and essentially whittled down to what they "should be" if all states of the system were observable.

So for your system, as long as you aren't aliasing your inputs with the FFT you shouldn't need any of the more crazy filters and can probably go with a PID control system using an FIR or IIR.

Further, since you aren't entirely sure of what the system is that you're modelling it would be a good idea to make sure that your signal isn't getting Borked by the FFT and try to make that signal as clean as possible as an input before even going into filtering out noise and disturbances, that way you're making your controls/signal processing job as easy as possible on yourself.

ADDENDUM: Just read TomL's answer, and it has a grain of truth in it. Matlab and Simulink are great for this kind of problem, with Matlab's built in DSP toolbox you can easily build out most easy to intermediate signal processing jobs and with their new HDL toolbox if you're using VHDL or Verilog you can even get the code spit out for you. As well, once that IP block is built you can push it into a Simulink simulation with a/your FFT and signal setup so you can quickly and easily test the overall validity of different filtering types and methods without having to resort to testing different builds in whatever language/stack you're currently working on. So once you pick whatever method you can easily mock it up for yourself, your investors, or your higher ups. Adding this to any controls/signal processing stack makes your life so much easier in the long run that it's what I start any of my jobs/projects with now.

Using a high level approach first will allow you to be able to break your system down into its more basic 30,000 ft view blocks that you can then push into whatever control system fits those blocks best.

TL;DR: Make sure your signals as good as it can get and you aren't breaking it in your FFT, model how you want the signal processed, fit a filter to the model (Kalman probably won't be it).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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