# Digital filter implementation in C (embedded)

I am a recent grad and my new project at work deals with taking the signal from an electret microphone and getting SPL values for 10 standard frequency bands.

The analog amplification/conditioning is completed so I am now trying to figure out what do in terms of sampling/filtering. My frequency bands are:

• 31.5, 63, 125, 250, 500, 1000, 2000, 4000, 8000, and 16000 Hz

I decided that I should be able to use a 160kHz sampling rate (apparently 5-10 * Nyquist rate is recommended according to my old notes) and use 10 2nd order Butterworth bandpass filters that were designed using mkfilter. After this point I am unsure how to proceed.

Would I simply use the 16kHz filter every sample, the 8kHz filter every 2 samples, the 4kHz filter every 4 samples and so on? ( I am getting these numbers by using 5*Nyquist rate for each band, e.g. 1/(8000Hz*2*5)/(1/160000Hz) ) ? Then I would then convert the values to a pressure and do the math necessary for a SPL measurement. Is there a better way to approach this? Is my understanding correct?

The hardware I am working with has a 48MHz clock and 32kB of flash and 4kB of RAM.

• Maybe have a look at FFT and/or the Goertzel algorithm. – JimmyB Apr 25 '16 at 11:35
• "has a 48MHz clock" - And how much time do you have to perform the calculations? At what frequency do you need new output values? – JimmyB Apr 25 '16 at 11:38