Separating Frequencies by Picaxe?

Hi All,

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

Reply to
Homer
Loading thread data ...

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

  1. how to go about writing software from microcontrollers?
  2. how to go about structuring and performing your project's task?
  3. are there other ways to do it other than Goertzel?

Peter

Reply to
Peter Dickerson

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,

Reply to
Homer

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
Reply to
Tim Wescott

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.

CHIMES.WAV 0: 951 73 219 805 1 1023 1022 2 1018 6 1: 73 951 950 74 970 54 55 969 220 804 2: 55 969 54 970 951 73 48 976 975 49 3: 976 48 975 49 982 42 55 969 146 878 4: 987 37 36 988 55 969 976 48 970 54

CHORD.WAV 0: 46 978 20 1004 26 998 1022 2 18 1006 1: 46 978 18 1006 85 939 28 996 21 1003 2: 46 978 1015 9 1003 21 18 1006 52 972 3: 46 978 997 27 1003 21 9 1015 1010 14 4: 46 978 27 997 28 996 21 1003 998 26

DING.WAV 0: 37 987 36 988 1 1023 1022 2 109 915 1: 37 987 988 36 110 914 986 38 183 841 2: 987 37 36 988 110 914 986 38 841 183 3: 988 36 987 37 109 915 35 989 182 842 4: 37 987 36 988 110 914 183 841 256 768

NOTIFY.WAV 0: 41 983 1023 1 40 984 122 902 1022 2 1: 983 41 123 901 819 205 942 82 737 287 2: 983 41 901 123 819 205 287 737 369 655 3: 983 41 901 123 819 205 737 287 942 82 4: 983 41 123 901 124 900 206 818 942 82

TADA.WAV 0: 1023 1 1015 9 2 1022 1021 3 4 1020 1: 18 1006 6 1018 9 1015 72 952 1012 12 2: 1018 6 1012 12 49 975 987 37 927 97 3: 1021 3 1020 4 9 1015 974 50 5 1019 4: 1018 6 1006 18 12 1012 97 927 1015 9

RECYCLE.WAV 0: 156 868 954 70 163 861 142 882 150 874 1: 172 852 821 203 89 935 746 278 79 945 2: 84 940 52 972 133 891 180 844 936 88 3: 933 91 56 968 951 73 119 905 78 946 4: 114 910 69 955 102 922 116 908 80 944

Reply to
linnix

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

Reply to
vze24h5m

maybe this would be a better choice. The documentation is rather pathetic though, last time I looked

formatting link

martin

Reply to
martin griffith

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.