Hi,
I've got some strange noises while adding patchcord\AudioConnection to fft256 module..
if I remove this patchcords the noise disappear.
I have recorded the sound with and without the patchcords please :
https://drive.google.com/open?id=0B9-FWhDSq1shMTkzTWJ4RUlLWHM
Any idea what is wrong?
This is my code :
Thanks in advance..
I've got some strange noises while adding patchcord\AudioConnection to fft256 module..
if I remove this patchcords the noise disappear.
I have recorded the sound with and without the patchcords please :
https://drive.google.com/open?id=0B9-FWhDSq1shMTkzTWJ4RUlLWHM
Any idea what is wrong?
This is my code :
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
//#include <SD.h>
#include <SerialFlash.h>
// 1 Left
// 2 Right
// 3 Center
AudioInputI2SQuad i2s_quad2;
AudioOutputI2SQuad i2s_quad1;
AudioAnalyzeFFT256 fft256_1;
AudioAnalyzeFFT256 fft256_3;
AudioAnalyzeFFT256 fft256_2;
AudioMixer4 mixer2;
AudioMixer4 mixer1;
AudioOutputUSB usb1;
AudioConnection patchCord1(i2s_quad2, 1, fft256_1, 0); <----------
AudioConnection patchCord2(i2s_quad2, 1, mixer1, 1);
AudioConnection patchCord3(i2s_quad2, 1, mixer2, 1);
AudioConnection patchCord4(i2s_quad2, 2, fft256_2, 0); <----------
AudioConnection patchCord5(i2s_quad2, 2, mixer1, 2);
AudioConnection patchCord6(i2s_quad2, 2, mixer2, 2);
AudioConnection patchCord7(i2s_quad2, 3, fft256_3, 0); <----------
AudioConnection patchCord8(i2s_quad2, 3, mixer1, 3);
AudioConnection patchCord9(i2s_quad2, 3, mixer2, 3);
AudioConnection patchCord11(mixer1, 0, usb1, 1);
AudioConnection patchCord12(mixer2, 0, usb1, 0);
AudioControlSGTL5000 sgtl5000_1; //xy=173.03053283691406,88.90054130554199
AudioControlSGTL5000 sgtl5000_2; //xy=183.1610044313146,142.78680452978827
const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;
String val;
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(12);
// Enable the first audio shield, select input, and enable output
sgtl5000_1.setAddress(LOW);
sgtl5000_1.enable();
sgtl5000_1.inputSelect(myInput);
sgtl5000_1.lineInLevel(15);
sgtl5000_1.volume(1);
// Enable the second audio shield, select input, and enable output
sgtl5000_2.setAddress(HIGH);
sgtl5000_2.enable();
sgtl5000_2.inputSelect(myInput);
sgtl5000_2.lineInLevel(15);
sgtl5000_2.volume(1);
sgtl5000_1.adcHighPassFilterDisable();
sgtl5000_2.adcHighPassFilterDisable();
fft256_1.windowFunction(AudioWindowHanning256);
fft256_2.windowFunction(AudioWindowHanning256);
fft256_3.windowFunction(AudioWindowHanning256);
// filter1.frequency(100);
// filter1.resonance(0.707);
// mixer1 LEFT
mixer1.gain(1, 0);
mixer1.gain(2, 0);
mixer1.gain(3, 0);
// mixer2 RIGHT
mixer2.gain(1, 0);
mixer2.gain(2, 0);
mixer2.gain(3, 0);
// mixer2.gain(3, 0.5);
Serial.begin(9600);
Serial.flush();
establishContact();
}
void establishContact() {
while (Serial.available() <= 0) {
Serial.println("A"); // send a capital A
delay(300);
}
}
//bool one=false;
void loop() {
// Serial.flush(); //flush all previous received and transmitted data
if(Serial.available() > 0){
val = Serial.readStringUntil('\n');
String sensCode = val.substring(0,3);
if(sensCode == "L1:"){
String l1= val.substring(3,7);
mixer1.gain(1, l1.toFloat());
} else if(sensCode == "L2:"){
String l1= val.substring(3,7);
mixer1.gain(2, l1.toFloat());
} else if(sensCode == "L3:"){
String l1= val.substring(3,7);
mixer1.gain(3, l1.toFloat());
} else if(sensCode == "R1:"){
String l1= val.substring(3,7);
mixer2.gain(1, l1.toFloat());
} else if(sensCode == "R2:"){
String l1= val.substring(3,7);
mixer2.gain(2, l1.toFloat());
} else if(sensCode == "R3:"){
String l1= val.substring(3,7);
mixer2.gain(3, l1.toFloat());
}
}
else {
int n;
int i;
if (fft256_1.available()) {
// each time new FFT data is available
// print it all to the Arduino Serial Monitor
Serial.print("FFT1: ");
for (i=0; i<128; i++) {
n = fft256_1.output[i];
Serial.print(n);
Serial.print(",");
delay(2);
}
Serial.println();
delay(2);
}
if (fft256_2.available()) {
// each time new FFT data is available
// print it all to the Arduino Serial Monitor
Serial.print("FFT2: ");
for (i=0; i<128; i++) {
n = fft256_2.output[i];
Serial.print(n);
Serial.print(",");
delay(2);
}
Serial.println();
delay(2);
}
if (fft256_3.available()) {
// each time new FFT data is available
// print it all to the Arduino Serial Monitor
Serial.print("FFT3: ");
for (i=0; i<128; i++) {
n = fft256_3.output[i];
Serial.print(n);
Serial.print(",");
delay(2);
}
Serial.println();
delay(2);
}
}
}
Thanks in advance..