I am Software programmer and the software part should not be a big deal IF I know what should I implement (though, have never done PIC programming). Regarding the Hardware, very rusty (I've done analog/digital circuits
15 years ago) but couple of good examples should do the job for me.
I seriously question whether any of my suggestions below will actually work; unless the processor in a PICAXE40 is way faster than I think it is you'll run out of horsepower long before you run out of algorithm. So use at your own risk...
You could use the Goertzel algorithm; if you structured your code right it'd be easy assuming you have the processor bandwidth. I'd make a data structure for each filter that specifies the coefficients and holds the state data, then use one routine to actually do the filtering. In a processor with very little RAM I'd split the structure into a ROM-able one with coefficients and a pointer to RAM, with just the states in RAM.
You'll find that the Goertzel algorithm has it's drawbacks. You may prefer to use 10 IIR bandpass filters. The Goertzel algorithm is really just an IIR implementation of a specific bandpass filter, so making a more generic filter should be easy. This also means you can use the same technique of many coefficient structures and one filter routine.
You may find that demodulating the frequencies (by multiplying the input by sine and cosine waves at the frequencies of interest) and low-passing the result will get you better results. This is mathematically the same as the IIR filter method, but may lead to more pleasing code.
Good luck. You may want to pick up a copy of Rick Lyon's "Understanding Digital Signal Processing" -- it'll help.
--
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Posting from Google? See http://cfaj.freeshell.org/google/
"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
I already posted the algorithm here a few days ago, all you need to do is speed it up. If you wait a couple of months, I might post a detail implementation with my cc contest.
It can be done with a 20MHz ARM for several updates per second.
We need 1K of lookup table and 6K of codes including floating points, but excluding tri functions.
Good alternative, but it's not going to save any processing time. The Goertzel code is surprising clean and simple anyway.
Another alternative is the good old FFT, followed by Gortzel. When the tracked frequencies are fading, a couple of FFTs (takes longer) can pull in new sets for tracking. For instance, here are some famous window sounds (most of us have heard, liked or hated them). They are ranked by power, within the 1024 samples. Most have characteristic frequencies within a few runs. "RECYCLE" is the exception, which is almost like white noise.
Homer; If all you're trying to do is split audio onto 10 bands and then display each band on a LED bar graph, do you really need to use a micro? You could use opamps as bandpass filters, and feed the output of each filter to a separate bar graph driver (LM3914, etc). This approach would use more parts, but may be simpler than using a DSP. sci.electronics.design would be a good place to ask about opamp filters.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.