I would like to analyze an audio signal on an arduino board. The programming part seems managable, but I don't know how to get a proper signal to analyze.
If I'm sampling a x Hz, then any frequency component higher than x/2 Hz in the input signal cannot be distinguished from a signal the same number of Hz lower than x/2 Hz, and so should be filtered out before sampling.
There are many web pages describing a simple low-pass filter: the inputs signal passes through a resistor R, and then through a capacitor C back to ground and you're supposed to take the output across the capacitor. There are handy formulas to compute the cutoff-frequency based on R and C, but they seem too simple...
Now, my strengths are in programming and not in electronics so I have to wonder:
That filtered output signal has to go via an analog-input pin through the atmega chip and back out again - doesn't that chip have some resistance and impedance as well, that should be taken into account when choosing R and C?
Same thing for any resistance/impedance of the input signal
I've read that the analog input pins expect a positive-only signal, but audio signal vary between plus and minus. So some DC bias has to be added to the signal. Can that be done without again having to alter the value of R and C?
However a simple RC filter is only a first order filter. To get an appreciable amount of attenuation at only one octave away from the cut-off point you need to go for at least a 6th order filter. This at best will involve three op amps. Google "active filter design" for ways to do this.
I intend to do an FFT using Sorensen's in-place split-radix algoritm for real (i.e. not complex) inputs. I estimate it is possible to do an FFT on 256 sample values in less than 1/30 second (based on how fast it computed the mandelbrot set).
This will then be displayed on two 8x8 pixel LED matrixes either as 16 bars for 16 selected frequencies or displaying all 128 frequencies with one LED each. With 14kHz sample frequency, I could see 55 - 7000 Hz.
Maybe I'm too optimistic as to what is possible, but hey, I've just discovered the Arduino and writing programs for it takes me back to the good old homecomputers of the 1980's where you had control over every byte and clockcycle!