ShreddinPB
Member
Hey guys, still trying to get my audio project working. I do have the audio shield and fht working with that, but I need to just get basic spectrum from it. I really just need lows, mids, and highs. I am doing something wrong however. How do I just get those 3 groups?
I hacked out the code from my much larger project and this is the JIST of what I tried..
The results of this seems to be any sounds are read by the low band.
Am I just using the wrong values in the read?
I hacked out the code from my much larger project and this is the JIST of what I tried..
The results of this seems to be any sounds are read by the low band.
Am I just using the wrong values in the read?
Code:
AudioInputI2S i2s1; //xy=136,96
AudioMixer4 mixer1; //xy=459,109
AudioAnalyzePeak peak1; //xy=677,84
AudioOutputAnalog dac1; //xy=690,269
AudioAnalyzeFFT256 myFFT; //xy=694,182
AudioConnection patchCord1(i2s1, 0, mixer1, 0);
AudioConnection patchCord2(i2s1, 1, mixer1, 1);
AudioConnection patchCord3(mixer1, myFFT);
AudioConnection patchCord4(mixer1, peak1);
AudioConnection patchCord5(mixer1, dac1);
const int myInput = AUDIO_INPUT_MIC;
AudioControlSGTL5000 audioShield;
float lowBand = 0.0;
float midBand = 0.0;
float highBand = 0.0;
void setup() {
Serial.begin(57600);
delay(3000); // 3 second delay for recovery
audioShield.enable();
audioShield.inputSelect(myInput);
audioShield.volume(0.5);
}
void vuMeter()
{
//float n;
//int i;
if (myFFT.available()) {
lowBand = myFFT.read(0,42);
midBand = myFFT.read(43,85);
highBand = myFFT.read(85,127);
Serial.print(lowBand);
Serial.print(" ");
Serial.print(midBand);
Serial.print(" ");
Serial.print(highBand);
Serial.println();
}
}