I am totally new in world of Microcontrollers so bear with me. I have a PICAXE40 and what I am trying to do with it is:
- Connect its ADC input to audio signal coming from music player
- Ask it to separate frequencies to separate range of frequencies (10 of them)
- Pass those frequencies to LM3913 and 10 LEDs on each for a 10x10 music dancer.
I've heard about Goertzel algorithm but I have no idea how to do anything like that with microcontroller. Anybody can help me here?
Thanks in advace,
Homer
Didn't find your answer? Ask the community — no account required.
P
Peter Dickerson
It's not clear where you are coming from. New to microcontrollers as a software engineer or as a hardware guy? so are you asking
how to go about writing software from microcontrollers?
how to go about structuring and performing your project's task?
are there other ways to do it other than Goertzel?
Peter
H
Homer
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.
Peter Dickers> > Hi All,
T
Tim Wescott
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
L
linnix
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.
-Dave Pollum
M
martin griffith
maybe this would be a better choice. The documentation is rather pathetic though, last time I looked
formatting link
martin
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.