memoguereque
Member
Hello,
I'm having trouble to get sound from my headphone output. First i tried to make a connection from mic input directly to audio output, then i thought that the problem was due to impedance or some microphone specs.
Then i tried with this sketch ,that creates a sinewave at some frecuency, and still i can hear nothing. I have the board directly attached to the teensy 3.1. Also the FFT with the microphone works just fine. I only have the problem of the audio output. Can you please help me?
Thank you,
I'm having trouble to get sound from my headphone output. First i tried to make a connection from mic input directly to audio output, then i thought that the problem was due to impedance or some microphone specs.
Then i tried with this sketch ,that creates a sinewave at some frecuency, and still i can hear nothing. I have the board directly attached to the teensy 3.1. Also the FFT with the microphone works just fine. I only have the problem of the audio output. Can you please help me?
Thank you,
Code:
//const int myInput = AUDIO_INPUT_LINEIN;
const int myInput = AUDIO_INPUT_MIC;
// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioInputI2S audioInput; // audio shield: mic or line-in
AudioSynthWaveformSine sinewave;
AudioAnalyzeFFT1024 myFFT;
AudioOutputI2S audioOutput; // audio shield: headphones & line-out
// Connect either the live input or synthesized sine wave
//AudioConnection patchCord1(audioInput, 0, myFFT, 0);
//AudioConnection patchCord2(audioInput, 0, audioOutput, 0);
//AudioConnection patchCord3(audioInput, 1, audioOutput, 1);
AudioConnection patchCord1(sinewave, 0, myFFT, 0);
AudioConnection patchCord2(sinewave, 0, audioOutput, 0);
AudioConnection patchCord3(sinewave, 1, audioOutput, 1);
AudioControlSGTL5000 audioShield;
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(12);
// Enable the audio shield and set the output volume.
audioShield.enable();
audioShield.inputSelect(myInput);
audioShield.volume(1);
// Configure the window algorithm to use
myFFT.windowFunction(AudioWindowHanning1024);
//myFFT.windowFunction(NULL);
// Create a synthetic sine wave, for testing
// To use this, edit the connections above
sinewave.amplitude(1);
sinewave.frequency(1034.007);
}
void loop() {
float n;
int i;
if (myFFT.available()) {
// each time new FFT data is available
// print it all to the Arduino Serial Monitor
Serial.print("FFT: ");
for (i=0; i<40; i++) {
n = myFFT.read(i);
if (n >= 0.01) {
Serial.print(n);
Serial.print(" ");
} else {
Serial.print(" - "); // don't print "0.00"
}
}
Serial.println();
}
}