Arduino Audio Filter

hi everybody,

Well I've been trying to build an audio filter on arduino, which takes in input from a mp3 song (thru a 3.5mm jack on d arduino), then filter out the different frequency ranges like the bass (<400hz), vocals (400hz - 5khz) and treble (>5khz).

The input audio signal after giving a DC offset is fed to the ADC of the arduino.

At first, I thought maybe go with three filters, low pass, high pass and band pass. But then i thought of using arduino itself to process the signal directly using FFT or some algorithm.

The problem is I'm not able to program it. Please help me in getting the FFT to identify and differentiate these frequencies.

btw, i posted something similar to this earlier, sorry for that.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1278851609

I too could do with a littl ehel on this subject.

Ive Coded the aruino to accept audio input and output it using one of the PWM pins at a very high rate by changing the regester values.

My next step is to manipulate this data. I want to be able to filter this input to only output iether a bandwidth set digitally in the code, or just 1 single frequency.

Ive been reading into fft, but have yet to find something native to the arduino.

Ive been thinkin about designing my own code that would measure the incoming signal and compare it to previous samples to determin the peek and trough of the wave, I could than calculate the time between these waves to determin the frequency. However this seems too slow, and by the time ive done this alagarithm would I be to late to decide wether the signal should be filtered or not.

Here is the code I am runing on the arduino atm.

#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))      //AnalogRead Settings
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))      //AnalogRead Settings

// vars altered by interrupt
volatile boolean f_sample;
volatile byte badc1;
volatile byte ibb;



void setup()
{

  // set adc prescaler  to 64 for 19kHz sampling frequency
  cbi(ADCSRA, ADPS2);
  sbi(ADCSRA, ADPS1);
  sbi(ADCSRA, ADPS0);




  sbi(ADMUX,ADLAR);  // 8-Bit ADC in ADCH Register
  sbi(ADMUX,REFS0);  // VCC Reference
  cbi(ADMUX,REFS1);
  cbi(ADMUX,MUX0);   // Set Input Multiplexer to Channel 0
  cbi(ADMUX,MUX1);
  cbi(ADMUX,MUX2);
  cbi(ADMUX,MUX3);


  // Timer2 PWM Mode set to fast PWM 
  cbi (TCCR2A, COM2A0);
  sbi (TCCR2A, COM2A1);
  sbi (TCCR2A, WGM20);
  sbi (TCCR2A, WGM21);

  cbi (TCCR2B, WGM22);

  // Timer2 Clock Prescaler to : 1 
  sbi (TCCR2B, CS20);
  cbi (TCCR2B, CS21);
  cbi (TCCR2B, CS22);

  // Timer2 PWM Port Enable
  sbi(DDRB,3);                    // set digital pin 11 to output

  cbi (TIMSK0,TOIE0);              // disable Timer0 !!! delay is off now
  sbi (TIMSK2,TOIE2);              // enable Timer2 Interrupt
  
}





void loop()
{
  while (!f_sample) {         // while f_sample = 0, waiting for input
  }
  f_sample=false;

  OCR2A=badc1;                // output audio to PWM port (pin 11)


}


ISR(TIMER2_OVF_vect) {

  PORTB = PORTB  | 1 ;


      badc1=ADCH;                    // get ADC channel 0
      f_sample=true;

ibb++;                          // short delay before start conversion
ibb--; 
ibb++; 
ibb--;    

sbi(ADCSRA,ADSC);               // start next conversion

}

Thanks, Phil.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1262129475/all