Hello Steven,
Thank you so much for your detailed replies. I tried to connect the mic and sdpaly together with the mixer, and unfortunately still it does not work. Attached is the code I am using. If I put "sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);" I would only hear to the output from mic, while if I delete that line of code, than teensy would only play the music from the SDcard. It seems that there is not a "inputselect" function in "control_sgtl5000.cpp" file(where "micGain" function locates) so I do not know if there are other options I can use. Would you mind take a look at the code below and point out what is wrong?
// code starts
///////////////////////////////////
// copy the Design Tool code here
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=197.1999969482422,114.19999694824219
AudioPlaySdWav playSdWav1; //xy=199.1999969482422,258.1999969482422
AudioMixer4 mixer2; //xy=429.1999969482422,256.1999969482422
AudioMixer4 mixer1; //xy=433.2000274658203,122.19999694824219
AudioOutputI2S i2s2; //xy=655.1999969482422,194.1999969482422
AudioConnection patchCord1(i2s1, 0, mixer1, 0);
AudioConnection patchCord2(i2s1, 0, mixer2, 0);
AudioConnection patchCord3(playSdWav1, 0, mixer1, 1);
AudioConnection patchCord4(playSdWav1, 1, mixer2, 1);
AudioConnection patchCord5(mixer2, 0, i2s2, 1);
AudioConnection patchCord6(mixer1, 0, i2s2, 0);
AudioControlSGTL5000 sgtl5000_1; //xy=485.1999969482422,356.1999969482422
// GUItool: end automatically generated code
// GUItool: end automatically generated code
///////////////////////////////////
void setup() {
Serial.begin(9600);
AudioMemory(8);
sgtl5000_1.enable();
sgtl5000_1.volume(0.2);
//sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.micGain(18);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
mixer1.gain(0, 0.4);
mixer1.gain(1, 0.4);
mixer2.gain(0, 0.4);
mixer2.gain(1, 0.4);
delay(1000);
}
void loop() {
if (playSdWav1.isPlaying() == false) {
Serial.println("Start playing 1");
playSdWav1.play("SDTEST1.WAV");
delay(10); // wait for library to parse WAV info
}
}